explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MLR : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #naM; plan #ZDSY; plan #yxz4; plan #W61u; plan #0ySG; plan #rZc; plan #Y9iQ; plan #H8QE; plan #u2eE; plan #a5b9; plan #vokT; plan #eRe5

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 80.404 881.659 ↓ 1.2 49,973 1

Nested Loop (cost=3,591.56..9,367.73 rows=41,898 width=956) (actual time=239.749..881.659 rows=49,973 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.016..0.018 rows=1 loops=1)

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
3. 94.115 801.237 ↓ 1.2 49,973 1

Hash Left Join (cost=3,591.56..8,947.72 rows=41,898 width=932) (actual time=239.721..801.237 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
4. 89.955 705.607 ↓ 1.2 49,973 1

Hash Left Join (cost=3,566.81..8,346.88 rows=41,898 width=878) (actual time=238.184..705.607 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
5. 91.360 615.587 ↓ 1.2 49,973 1

Hash Left Join (cost=3,565.34..7,769.63 rows=41,898 width=868) (actual time=238.095..615.587 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
6. 80.745 523.657 ↓ 1.2 49,973 1

Hash Left Join (cost=3,552.69..7,182.99 rows=41,898 width=832) (actual time=237.502..523.657 rows=49,973 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
7. 126.386 442.895 ↓ 1.2 49,973 1

Hash Join (cost=3,539.54..7,008.61 rows=41,898 width=316) (actual time=237.458..442.895 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.empresa_id = emp.id)
8. 79.103 79.103 ↓ 1.0 49,975 1

Seq Scan on empresas_sucursales (cost=0.00..2,612.96 rows=49,958 width=237) (actual time=0.012..79.103 rows=49,975 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 5622
9. 69.714 237.406 ↓ 1.2 49,834 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 6001kB
10. 93.613 167.692 ↓ 1.2 49,834 1

Hash Join (cost=1.58..3,017.22 rows=41,786 width=95) (actual time=0.133..167.692 rows=49,834 loops=1)

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

Seq Scan on empresas emp (cost=0.00..2,410.94 rows=49,822 width=82) (actual time=0.015..73.979 rows=49,834 loops=1)

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

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

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

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

14. 0.006 0.017 ↑ 35.0 4 1

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

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

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

16. 0.275 0.570 ↑ 1.0 251 1

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

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

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

18. 0.028 0.065 ↑ 1.2 18 1

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

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

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

20. 0.827 1.515 ↑ 1.0 700 1

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

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

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