explain.depesz.com

PostgreSQL's explain analyze made readable

Result: j3my : Optimization for: 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; plan #MLR

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 72.645 742.482 ↓ 1.2 49,973 1

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

2. 0.017 0.017 ↑ 1.0 1 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

14. 0.005 0.012 ↑ 35.0 4 1

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

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

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

16. 0.225 0.429 ↑ 1.0 251 1

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

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

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

18. 0.015 0.033 ↑ 1.2 18 1

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

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

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

20. 0.601 1.135 ↑ 1.0 700 1

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

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

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