explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 68.736 694.445 ↓ 1.2 49,970 1

Nested Loop (cost=3,591.56..9,373.92 rows=41,982 width=956) (actual time=165.411..694.445 rows=49,970 loops=1)

2. 0.010 0.010 ↑ 1.0 1 1

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

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
3. 75.067 625.699 ↓ 1.2 49,970 1

Hash Left Join (cost=3,591.56..8,953.07 rows=41,982 width=932) (actual time=165.399..625.699 rows=49,970 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
4. 72.784 549.447 ↓ 1.2 49,970 1

Hash Left Join (cost=3,566.81..8,351.06 rows=41,982 width=878) (actual time=164.205..549.447 rows=49,970 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
5. 74.024 476.629 ↓ 1.2 49,970 1

Hash Left Join (cost=3,565.34..7,772.66 rows=41,982 width=868) (actual time=164.163..476.629 rows=49,970 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
6. 68.402 402.115 ↓ 1.2 49,970 1

Hash Left Join (cost=3,552.69..7,184.97 rows=41,982 width=832) (actual time=163.661..402.115 rows=49,970 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
7. 105.075 333.701 ↓ 1.2 49,970 1

Hash Join (cost=3,539.54..7,010.28 rows=41,982 width=316) (actual time=163.633..333.701 rows=49,970 loops=1)

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

Seq Scan on empresas_sucursales (cost=0.00..2,612.90 rows=50,059 width=237) (actual time=0.003..65.015 rows=49,972 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 5621
9. 45.112 163.611 ↓ 1.2 49,831 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 6001kB
10. 71.510 118.499 ↓ 1.2 49,831 1

Hash Join (cost=1.58..3,017.22 rows=41,786 width=95) (actual time=0.061..118.499 rows=49,831 loops=1)

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

Seq Scan on empresas emp (cost=0.00..2,410.94 rows=49,822 width=82) (actual time=0.005..46.938 rows=49,831 loops=1)

  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
  • Rows Removed by Filter: 2
12. 0.030 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.021 0.021 ↓ 1.2 30 1

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

14. 0.005 0.012 ↑ 35.0 4 1

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

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

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

16. 0.235 0.490 ↑ 1.0 251 1

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

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

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

18. 0.019 0.034 ↑ 1.2 18 1

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

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

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

20. 0.593 1.185 ↑ 1.0 700 1

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

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

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