explain.depesz.com

PostgreSQL's explain analyze made readable

Result: eRe5 : 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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 79.521 879.012 ↓ 1.2 49,973 1

Nested Loop (cost=3,591.56..9,367.73 rows=41,898 width=956) (actual time=245.678..879.012 rows=49,973 loops=1)

2. 0.031 0.031 ↑ 1.0 1 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Seq Scan on empresas emp (cost=0.00..2,410.94 rows=49,822 width=82) (actual time=0.021..86.449 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.041 0.071 ↓ 1.2 30 1

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

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

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

14. 0.009 0.036 ↑ 35.0 4 1

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

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

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

16. 0.272 0.616 ↑ 1.0 251 1

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

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

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

18. 0.021 0.046 ↑ 1.2 18 1

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

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

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

20. 0.779 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.736 0.736 ↑ 1.0 700 1

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