explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 77.582 801.117 ↓ 1.2 49,970 1

Nested Loop (cost=3,591.56..9,374.01 rows=41,983 width=956) (actual time=194.252..801.117 rows=49,970 loops=1)

2. 0.009 0.009 ↑ 1.0 1 1

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

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

Hash Left Join (cost=3,591.56..8,953.14 rows=41,983 width=932) (actual time=194.241..723.526 rows=49,970 loops=1)

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

Hash Left Join (cost=3,566.81..8,351.13 rows=41,983 width=878) (actual time=192.977..637.432 rows=49,970 loops=1)

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

Hash Left Join (cost=3,565.34..7,772.71 rows=41,983 width=868) (actual time=192.922..555.722 rows=49,970 loops=1)

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

Hash Left Join (cost=3,552.69..7,185.00 rows=41,983 width=832) (actual time=192.461..472.108 rows=49,970 loops=1)

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

Hash Join (cost=3,539.54..7,010.31 rows=41,983 width=316) (actual time=192.420..394.515 rows=49,970 loops=1)

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

Seq Scan on empresas_sucursales (cost=0.00..2,612.91 rows=50,060 width=237) (actual time=0.011..60.708 rows=49,972 loops=1)

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

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

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

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

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

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

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

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

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

14. 0.006 0.022 ↑ 35.0 4 1

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

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

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

16. 0.227 0.446 ↑ 1.0 251 1

Hash (cost=9.51..9.51 rows=251 width=40) (actual time=0.446..0.446 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.020 0.043 ↑ 1.2 18 1

Hash (cost=1.21..1.21 rows=21 width=18) (actual time=0.043..0.043 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.007..0.023 rows=18 loops=1)

20. 0.627 1.254 ↑ 1.0 700 1

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

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

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