explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CMUf

Settings
# exclusive inclusive rows x rows loops node
1. 1.720 603.505 ↑ 1.0 1,000 1

Limit (cost=0.86..8,584.43 rows=1,000 width=579) (actual time=0.357..603.505 rows=1,000 loops=1)

2. 1.633 601.785 ↑ 53.1 1,000 1

Append (cost=0.86..455,496.25 rows=53,066 width=579) (actual time=0.356..601.785 rows=1,000 loops=1)

3. 8.064 600.152 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.86..444,287.69 rows=52,313 width=461) (actual time=0.354..600.152 rows=1,000 loops=1)

4. 4.542 141.088 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.86..48,990.90 rows=52,313 width=441) (actual time=0.236..141.088 rows=1,000 loops=1)

  • Join Filter: (empresas_sucursales.type = empresas_sucursales_types.id)
5. 11.055 134.546 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.86..48,205.17 rows=52,313 width=434) (actual time=0.225..134.546 rows=1,000 loops=1)

6. 4.510 116.491 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.86..46,736.56 rows=52,313 width=380) (actual time=0.186..116.491 rows=1,000 loops=1)

7. 4.004 93.981 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.72..38,098.92 rows=52,313 width=369) (actual time=0.176..93.981 rows=1,000 loops=1)

8. 5.156 82.977 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.58..29,056.92 rows=52,313 width=333) (actual time=0.161..82.977 rows=1,000 loops=1)

9. 5.636 64.821 ↑ 52.3 1,000 1

Nested Loop Left Join (cost=0.58..27,608.29 rows=52,313 width=319) (actual time=0.129..64.821 rows=1,000 loops=1)

10. 15.337 52.185 ↑ 52.3 1,000 1

Nested Loop (cost=0.58..26,159.66 rows=52,313 width=304) (actual time=0.092..52.185 rows=1,000 loops=1)

11. 24.848 24.848 ↑ 52.3 1,000 1

Index Scan Backward using empresas_sucursales_nro_patronal_key on empresas_sucursales (cost=0.29..5,658.17 rows=52,316 width=239) (actual time=0.018..24.848 rows=1,000 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 149
12. 12.000 12.000 ↑ 1.0 1 1,000

Index Scan using empresas_pk on empresas emp (cost=0.29..0.38 rows=1 width=81) (actual time=0.011..0.012 rows=1 loops=1,000)

  • Index Cond: (id = empresas_sucursales.empresa_id)
  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
13. 7.000 7.000 ↑ 1.0 1 1,000

Index Scan using empresas_types_id_idx on empresas_types (cost=0.00..0.02 rows=1 width=23) (actual time=0.006..0.007 rows=1 loops=1,000)

  • Index Cond: (emp.type = id)
14. 13.000 13.000 ↑ 1.0 1 1,000

Index Scan using empresas_categorias_id_categoria_empresa_idx on empresas_categorias (cost=0.00..0.02 rows=1 width=18) (actual time=0.012..0.013 rows=1 loops=1,000)

  • Index Cond: (emp.id_categoria_empresa = id_categoria_empresa)
15. 7.000 7.000 ↑ 1.0 1 1,000

Index Scan using city_id_distrito_id_idx on city (cost=0.14..0.16 rows=1 width=40) (actual time=0.005..0.007 rows=1 loops=1,000)

  • Index Cond: (empresas_sucursales.city_id = id)
16. 18.000 18.000 ↑ 1.0 1 1,000

Index Scan using distritos_pkey on distritos (cost=0.14..0.16 rows=1 width=19) (actual time=0.017..0.018 rows=1 loops=1,000)

  • Index Cond: (empresas_sucursales.distrito_id = id)
17. 7.000 7.000 ↑ 1.0 1 1,000

Index Scan using actividad_econ_id_activ_econ_idx on actividad_econ (cost=0.00..0.02 rows=1 width=58) (actual time=0.006..0.007 rows=1 loops=1,000)

  • Index Cond: (empresas_sucursales.id_activ_econ = id_activ_econ)
18. 1.994 2.000 ↑ 1.0 1 1,000

Materialize (cost=0.00..1.04 rows=1 width=23) (actual time=0.001..0.002 rows=1 loops=1,000)

19. 0.006 0.006 ↑ 1.0 1 1

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

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
20. 6.000 6.000 ↑ 1.0 1 1,000

Index Scan using empresas_tipo_inscripcion_id_tipo_inscripcion_idx on empresas_tipo_inscripcion (cost=0.00..0.02 rows=1 width=24) (actual time=0.004..0.006 rows=1 loops=1,000)

  • Index Cond: (empresas_sucursales.id_tipo_inscripcion = id_tipo_inscripcion)
21.          

SubPlan (forNested Loop Left Join)

22. 3.000 445.000 ↑ 1.0 1 1,000

Limit (cost=7.53..7.53 rows=1 width=27) (actual time=0.444..0.445 rows=1 loops=1,000)

23. 8.000 442.000 ↑ 2.0 1 1,000

Sort (cost=7.53..7.53 rows=2 width=27) (actual time=0.442..0.442 rows=1 loops=1,000)

  • Sort Key: cambio_situacion_empresa.fecha_creacion, cambio_situacion_empresa.id_cambio_situacion_empresa
  • Sort Method: quicksort Memory: 25kB
24. 4.979 434.000 ↑ 2.0 1 1,000

Hash Join (cost=1.57..7.52 rows=2 width=27) (actual time=0.431..0.434 rows=1 loops=1,000)

  • Hash Cond: (cambio_situacion_empresa.situacion_act = situacion_emp.id_situacion)
25. 429.000 429.000 ↑ 2.0 1 1,000

Index Scan using cambio_situacion_empresa_nro_patronal_fecha_creacion_id_cam_idx on cambio_situacion_empresa (cost=0.42..6.33 rows=2 width=20) (actual time=0.428..0.429 rows=1 loops=1,000)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
26. 0.011 0.021 ↑ 1.0 7 1

Hash (cost=1.07..1.07 rows=7 width=15) (actual time=0.021..0.021 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
27. 0.010 0.010 ↑ 1.0 7 1

Seq Scan on situacion_emp (cost=0.00..1.07 rows=7 width=15) (actual time=0.004..0.010 rows=7 loops=1)

28. 0.000 0.000 ↓ 0.0 0

Sort (cost=10,676.02..10,677.90 rows=753 width=463) (never executed)

  • Sort Key: empresas_sucursales_1.nro_patronal
29. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=14.41..10,640.04 rows=753 width=463) (never executed)

30. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=14.41..4,940.23 rows=753 width=443) (never executed)

31. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=14.41..4,909.52 rows=753 width=436) (never executed)

32. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=14.41..4,858.81 rows=753 width=382) (never executed)

  • Hash Cond: (empresas_sucursales_1.distrito_id = distritos_1.id)
33. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=13.00..4,847.06 rows=753 width=371) (never executed)

  • Hash Cond: (empresas_sucursales_1.city_id = city_1.id)
34. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.29..4,824.03 rows=753 width=335) (never executed)

35. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.29..4,803.17 rows=753 width=321) (never executed)

36. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.29..4,782.32 rows=753 width=306) (never executed)

37. 0.000 0.000 ↓ 0.0 0

Seq Scan on empresas_sucursales empresas_sucursales_1 (cost=0.00..3,035.72 rows=753 width=302) (never executed)

  • Filter: ((type <> 1) AND (type <> 1))
38. 0.000 0.000 ↓ 0.0 0

Index Scan using empresas_pk on empresas emp_1 (cost=0.29..2.31 rows=1 width=20) (never executed)

  • Index Cond: (id = empresas_sucursales_1.empresa_id)
  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
39. 0.000 0.000 ↓ 0.0 0

Index Scan using empresas_types_id_idx on empresas_types empresas_types_1 (cost=0.00..0.02 rows=1 width=23) (never executed)

  • Index Cond: (emp_1.type = id)
40. 0.000 0.000 ↓ 0.0 0

Index Scan using empresas_categorias_id_categoria_empresa_idx on empresas_categorias empresas_categorias_1 (cost=0.00..0.02 rows=1 width=18) (never executed)

  • Index Cond: (emp_1.id_categoria_empresa = id_categoria_empresa)
41. 0.000 0.000 ↓ 0.0 0

Hash (cost=9.54..9.54 rows=254 width=40) (never executed)

42. 0.000 0.000 ↓ 0.0 0

Seq Scan on city city_1 (cost=0.00..9.54 rows=254 width=40) (never executed)

43. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.18..1.18 rows=18 width=19) (never executed)

44. 0.000 0.000 ↓ 0.0 0

Seq Scan on distritos distritos_1 (cost=0.00..1.18 rows=18 width=19) (never executed)

45. 0.000 0.000 ↓ 0.0 0

Index Scan using actividad_econ_id_activ_econ_idx on actividad_econ actividad_econ_1 (cost=0.00..0.06 rows=1 width=58) (never executed)

  • Index Cond: (empresas_sucursales_1.id_activ_econ = id_activ_econ)
46. 0.000 0.000 ↓ 0.0 0

Index Scan using empresas_sucursales_types_id_idx on empresas_sucursales_types empresas_sucursales_types_1 (cost=0.00..0.03 rows=1 width=23) (never executed)

  • Index Cond: (empresas_sucursales_1.type = id)
47. 0.000 0.000 ↓ 0.0 0

Index Scan using empresas_tipo_inscripcion_id_tipo_inscripcion_idx on empresas_tipo_inscripcion empresas_tipo_inscripcion_1 (cost=0.00..0.03 rows=1 width=24) (never executed)

  • Index Cond: (empresas_sucursales_1.id_tipo_inscripcion = id_tipo_inscripcion)
48.          

SubPlan (forNested Loop Left Join)

49. 0.000 0.000 ↓ 0.0 0

Limit (cost=7.53..7.53 rows=1 width=27) (never executed)

50. 0.000 0.000 ↓ 0.0 0

Sort (cost=7.53..7.53 rows=2 width=27) (never executed)

  • Sort Key: cambio_situacion_empresa_1.fecha_creacion, cambio_situacion_empresa_1.id_cambio_situacion_empresa
51. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1.57..7.52 rows=2 width=27) (never executed)

  • Hash Cond: (cambio_situacion_empresa_1.situacion_act = situacion_emp_1.id_situacion)
52. 0.000 0.000 ↓ 0.0 0

Index Scan using cambio_situacion_empresa_nro_patronal_fecha_creacion_id_cam_idx on cambio_situacion_empresa cambio_situacion_empresa_1 (cost=0.42..6.33 rows=2 width=20) (never executed)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
53. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.07..1.07 rows=7 width=15) (never executed)

54. 0.000 0.000 ↓ 0.0 0

Seq Scan on situacion_emp situacion_emp_1 (cost=0.00..1.07 rows=7 width=15) (never executed)