explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0ySG : Optimization for: Optimization for: Optimization for: Optimization for: plan #naM; plan #ZDSY; plan #yxz4; plan #W61u

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 72.438 750.082 ↓ 1.2 49,968 1

Nested Loop (cost=3,591.56..9,373.47 rows=41,977 width=956) (actual time=189.063..750.082 rows=49,968 loops=1)

2. 0.018 0.018 ↑ 1.0 1 1

Seq Scan on empresas_sucursales_types (cost=0.00..1.04 rows=1 width=40) (actual time=0.014..0.018 rows=1 loops=1)

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
3. 80.966 677.626 ↓ 1.2 49,968 1

Hash Left Join (cost=3,591.56..8,952.66 rows=41,977 width=932) (actual time=189.044..677.626 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
4. 77.276 595.511 ↓ 1.2 49,968 1

Hash Left Join (cost=3,566.81..8,350.73 rows=41,977 width=878) (actual time=187.885..595.511 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
5. 78.624 518.193 ↓ 1.2 49,968 1

Hash Left Join (cost=3,565.34..7,772.39 rows=41,977 width=868) (actual time=187.833..518.193 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
6. 72.768 439.157 ↓ 1.2 49,968 1

Hash Left Join (cost=3,552.69..7,184.77 rows=41,977 width=832) (actual time=187.411..439.157 rows=49,968 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
7. 113.752 366.359 ↓ 1.2 49,968 1

Hash Join (cost=3,539.54..7,010.10 rows=41,977 width=316) (actual time=187.367..366.359 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.empresa_id = emp.id)
8. 65.268 65.268 ↑ 1.0 49,970 1

Seq Scan on empresas_sucursales (cost=0.00..2,612.82 rows=50,053 width=237) (actual time=0.008..65.268 rows=49,970 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 5621
9. 49.870 187.339 ↓ 1.2 49,829 1

Hash (cost=3,017.22..3,017.22 rows=41,786 width=95) (actual time=187.339..187.339 rows=49,829 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 6001kB
10. 77.387 137.469 ↓ 1.2 49,829 1

Hash Join (cost=1.58..3,017.22 rows=41,786 width=95) (actual time=0.067..137.469 rows=49,829 loops=1)

  • Hash Cond: (emp.type = empresas_types.id)
11. 60.031 60.031 ↓ 1.0 49,829 1

Seq Scan on empresas emp (cost=0.00..2,410.94 rows=49,822 width=82) (actual time=0.009..60.031 rows=49,829 loops=1)

  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
  • Rows Removed by Filter: 2
12. 0.027 0.051 ↓ 1.2 30 1

Hash (cost=1.26..1.26 rows=26 width=21) (actual time=0.051..0.051 rows=30 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
13. 0.024 0.024 ↓ 1.2 30 1

Seq Scan on empresas_types (cost=0.00..1.26 rows=26 width=21) (actual time=0.003..0.024 rows=30 loops=1)

14. 0.006 0.030 ↑ 35.0 4 1

Hash (cost=11.40..11.40 rows=140 width=520) (actual time=0.030..0.030 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
15. 0.024 0.024 ↑ 35.0 4 1

Seq Scan on empresas_categorias (cost=0.00..11.40 rows=140 width=520) (actual time=0.009..0.024 rows=4 loops=1)

16. 0.193 0.412 ↑ 1.0 251 1

Hash (cost=9.51..9.51 rows=251 width=40) (actual time=0.412..0.412 rows=251 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
17. 0.219 0.219 ↑ 1.0 251 1

Seq Scan on city (cost=0.00..9.51 rows=251 width=40) (actual time=0.006..0.219 rows=251 loops=1)

18. 0.019 0.042 ↑ 1.2 18 1

Hash (cost=1.21..1.21 rows=21 width=18) (actual time=0.042..0.042 rows=18 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
19. 0.023 0.023 ↑ 1.2 18 1

Seq Scan on distritos (cost=0.00..1.21 rows=21 width=18) (actual time=0.005..0.023 rows=18 loops=1)

20. 0.592 1.149 ↑ 1.0 700 1

Hash (cost=16.00..16.00 rows=700 width=58) (actual time=1.149..1.149 rows=700 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 63kB
21. 0.557 0.557 ↑ 1.0 700 1

Seq Scan on actividad_econ (cost=0.00..16.00 rows=700 width=58) (actual time=0.005..0.557 rows=700 loops=1)