explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 71.942 736.573 ↓ 1.2 49,969 1

Nested Loop (cost=3,591.56..9,373.47 rows=41,977 width=956) (actual time=181.257..736.573 rows=49,969 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.007..0.010 rows=1 loops=1)

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
3. 80.755 664.621 ↓ 1.2 49,969 1

Hash Left Join (cost=3,591.56..8,952.66 rows=41,977 width=932) (actual time=181.245..664.621 rows=49,969 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
4. 77.023 582.662 ↓ 1.2 49,969 1

Hash Left Join (cost=3,566.81..8,350.73 rows=41,977 width=878) (actual time=180.033..582.662 rows=49,969 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
5. 77.916 505.594 ↓ 1.2 49,969 1

Hash Left Join (cost=3,565.34..7,772.39 rows=41,977 width=868) (actual time=179.978..505.594 rows=49,969 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
6. 72.568 427.212 ↓ 1.2 49,969 1

Hash Left Join (cost=3,552.69..7,184.77 rows=41,977 width=832) (actual time=179.502..427.212 rows=49,969 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
7. 110.746 354.627 ↓ 1.2 49,969 1

Hash Join (cost=3,539.54..7,010.10 rows=41,977 width=316) (actual time=179.472..354.627 rows=49,969 loops=1)

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

Seq Scan on empresas_sucursales (cost=0.00..2,612.82 rows=50,053 width=237) (actual time=0.010..64.438 rows=49,971 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 5621
9. 47.381 179.443 ↓ 1.2 49,830 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 6001kB
10. 75.036 132.062 ↓ 1.2 49,830 1

Hash Join (cost=1.58..3,017.22 rows=41,786 width=95) (actual time=0.080..132.062 rows=49,830 loops=1)

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

Seq Scan on empresas emp (cost=0.00..2,410.94 rows=49,822 width=82) (actual time=0.010..56.976 rows=49,830 loops=1)

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

Hash (cost=1.26..1.26 rows=26 width=21) (actual time=0.050..0.050 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.004 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.013 0.013 ↑ 35.0 4 1

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

16. 0.224 0.466 ↑ 1.0 251 1

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

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

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

18. 0.016 0.045 ↑ 1.2 18 1

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

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

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

20. 0.583 1.204 ↑ 1.0 700 1

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

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

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