explain.depesz.com

PostgreSQL's explain analyze made readable

Result: W61u : Optimization for: Optimization for: Optimization for: plan #naM; plan #ZDSY; plan #yxz4

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 79.733 901.108 ↓ 1.2 49,968 1

Nested Loop (cost=3,591.85..9,373.76 rows=41,977 width=956) (actual time=251.203..901.108 rows=49,968 loops=1)

2. 0.107 0.107 ↑ 1.0 1 1

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

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
3. 96.198 821.268 ↓ 1.2 49,968 1

Hash Left Join (cost=3,591.85..8,952.96 rows=41,977 width=932) (actual time=251.087..821.268 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
4. 87.951 723.513 ↓ 1.2 49,968 1

Hash Left Join (cost=3,567.10..8,351.02 rows=41,977 width=878) (actual time=249.515..723.513 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
5. 89.544 635.518 ↓ 1.2 49,968 1

Hash Left Join (cost=3,565.63..7,772.69 rows=41,977 width=868) (actual time=249.457..635.518 rows=49,968 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
6. 80.300 545.431 ↓ 1.2 49,968 1

Hash Left Join (cost=3,552.69..7,184.77 rows=41,977 width=832) (actual time=248.897..545.431 rows=49,968 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
7. 132.015 465.101 ↓ 1.2 49,968 1

Hash Join (cost=3,539.54..7,010.10 rows=41,977 width=316) (actual time=248.844..465.101 rows=49,968 loops=1)

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

Seq Scan on empresas_sucursales (cost=0.00..2,612.82 rows=50,053 width=237) (actual time=0.025..84.307 rows=49,970 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 5621
9. 73.797 248.779 ↓ 1.2 49,829 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 6001kB
10. 90.303 174.982 ↓ 1.2 49,829 1

Hash Join (cost=1.58..3,017.22 rows=41,786 width=95) (actual time=0.141..174.982 rows=49,829 loops=1)

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

Seq Scan on empresas emp (cost=0.00..2,410.94 rows=49,822 width=82) (actual time=0.029..84.587 rows=49,829 loops=1)

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

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

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

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

14. 0.008 0.030 ↑ 35.0 4 1

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

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

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

16. 0.278 0.543 ↑ 1.1 251 1

Hash (cost=9.64..9.64 rows=264 width=40) (actual time=0.543..0.543 rows=251 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
17. 0.265 0.265 ↑ 1.1 251 1

Seq Scan on city (cost=0.00..9.64 rows=264 width=40) (actual time=0.010..0.265 rows=251 loops=1)

18. 0.019 0.044 ↑ 1.2 18 1

Hash (cost=1.21..1.21 rows=21 width=18) (actual time=0.044..0.044 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.804 1.557 ↑ 1.0 700 1

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

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

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