explain.depesz.com

PostgreSQL's explain analyze made readable

Result: o2eN

Settings
# exclusive inclusive rows x rows loops node
1. 90.720 3,951.969 ↓ 1.1 58,950 1

Append (cost=417,361.62..428,700.96 rows=53,066 width=579) (actual time=2,910.412..3,951.969 rows=58,950 loops=1)

2. 352.833 2,992.523 ↓ 1.0 52,339 1

Sort (cost=417,361.62..417,492.40 rows=52,313 width=461) (actual time=2,910.410..2,992.523 rows=52,339 loops=1)

  • Sort Key: empresas_sucursales.nro_patronal
  • Sort Method: external merge Disk: 19856kB
3. 252.237 2,639.690 ↓ 1.0 52,339 1

Hash Left Join (cost=3,149.09..405,469.12 rows=52,313 width=461) (actual time=196.682..2,639.690 rows=52,339 loops=1)

  • Hash Cond: (empresas_sucursales.id_tipo_inscripcion = empresas_tipo_inscripcion.id_tipo_inscripcion)
4. 105.704 1,131.303 ↓ 1.0 52,339 1

Hash Left Join (cost=3,148.02..10,900.57 rows=52,313 width=441) (actual time=196.545..1,131.303 rows=52,339 loops=1)

  • Hash Cond: (empresas_sucursales.type = empresas_sucursales_types.id)
5. 122.653 1,025.586 ↓ 1.0 52,339 1

Hash Left Join (cost=3,146.97..10,180.21 rows=52,313 width=434) (actual time=196.502..1,025.586 rows=52,339 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
6. 104.759 901.330 ↓ 1.0 52,339 1

Hash Left Join (cost=3,121.55..9,435.49 rows=52,313 width=380) (actual time=194.877..901.330 rows=52,339 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
7. 107.546 796.529 ↓ 1.0 52,339 1

Hash Left Join (cost=3,120.14..8,715.22 rows=52,313 width=369) (actual time=194.808..796.529 rows=52,339 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
8. 92.553 688.485 ↓ 1.0 52,339 1

Hash Left Join (cost=3,107.43..7,985.34 rows=52,313 width=333) (actual time=194.284..688.485 rows=52,339 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
9. 103.587 595.902 ↓ 1.0 52,339 1

Hash Left Join (cost=3,106.34..7,760.19 rows=52,313 width=319) (actual time=194.230..595.902 rows=52,339 loops=1)

  • Hash Cond: (emp.type = empresas_types.id)
10. 192.343 492.240 ↓ 1.0 52,339 1

Hash Join (cost=3,104.66..7,039.22 rows=52,313 width=304) (actual time=194.123..492.240 rows=52,339 loops=1)

  • Hash Cond: (empresas_sucursales.empresa_id = emp.id)
11. 105.814 105.814 ↓ 1.0 52,341 1

Seq Scan on empresas_sucursales (cost=0.00..2,888.26 rows=52,316 width=239) (actual time=0.013..105.814 rows=52,341 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 6650
12. 85.210 194.083 ↓ 1.0 52,198 1

Hash (cost=2,452.32..2,452.32 rows=52,187 width=81) (actual time=194.083..194.083 rows=52,198 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 5855kB
13. 108.873 108.873 ↓ 1.0 52,198 1

Seq Scan on empresas emp (cost=0.00..2,452.32 rows=52,187 width=81) (actual time=0.013..108.873 rows=52,198 loops=1)

  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
  • Rows Removed by Filter: 2
14. 0.041 0.075 ↑ 1.0 30 1

Hash (cost=1.30..1.30 rows=30 width=23) (actual time=0.075..0.075 rows=30 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
15. 0.034 0.034 ↑ 1.0 30 1

Seq Scan on empresas_types (cost=0.00..1.30 rows=30 width=23) (actual time=0.006..0.034 rows=30 loops=1)

16. 0.020 0.030 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=18) (actual time=0.030..0.030 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
17. 0.010 0.010 ↑ 1.0 4 1

Seq Scan on empresas_categorias (cost=0.00..1.04 rows=4 width=18) (actual time=0.005..0.010 rows=4 loops=1)

18. 0.263 0.498 ↑ 1.0 254 1

Hash (cost=9.54..9.54 rows=254 width=40) (actual time=0.498..0.498 rows=254 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
19. 0.235 0.235 ↑ 1.0 254 1

Seq Scan on city (cost=0.00..9.54 rows=254 width=40) (actual time=0.006..0.235 rows=254 loops=1)

20. 0.022 0.042 ↑ 1.0 18 1

Hash (cost=1.18..1.18 rows=18 width=19) (actual time=0.042..0.042 rows=18 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
21. 0.020 0.020 ↑ 1.0 18 1

Seq Scan on distritos (cost=0.00..1.18 rows=18 width=19) (actual time=0.006..0.020 rows=18 loops=1)

22. 0.849 1.603 ↑ 1.0 730 1

Hash (cost=16.30..16.30 rows=730 width=58) (actual time=1.603..1.603 rows=730 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 66kB
23. 0.754 0.754 ↑ 1.0 730 1

Seq Scan on actividad_econ (cost=0.00..16.30 rows=730 width=58) (actual time=0.006..0.754 rows=730 loops=1)

24. 0.003 0.013 ↑ 1.0 1 1

Hash (cost=1.04..1.04 rows=1 width=23) (actual time=0.013..0.013 rows=1 loops=1)

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

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

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
26. 0.006 0.014 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=24) (actual time=0.014..0.014 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
27. 0.008 0.008 ↑ 1.0 3 1

Seq Scan on empresas_tipo_inscripcion (cost=0.00..1.03 rows=3 width=24) (actual time=0.005..0.008 rows=3 loops=1)

28.          

SubPlan (for Hash Left Join)

29. 104.678 1,256.136 ↑ 1.0 1 52,339

Limit (cost=7.53..7.53 rows=1 width=27) (actual time=0.024..0.024 rows=1 loops=52,339)

30. 366.373 1,151.458 ↑ 2.0 1 52,339

Sort (cost=7.53..7.53 rows=2 width=27) (actual time=0.022..0.022 rows=1 loops=52,339)

  • Sort Key: cambio_situacion_empresa.fecha_creacion, cambio_situacion_empresa.id_cambio_situacion_empresa
  • Sort Method: top-N heapsort Memory: 25kB
31. 261.672 785.085 ↑ 2.0 1 52,339

Hash Join (cost=1.57..7.52 rows=2 width=27) (actual time=0.011..0.015 rows=1 loops=52,339)

  • Hash Cond: (cambio_situacion_empresa.situacion_act = situacion_emp.id_situacion)
32. 523.390 523.390 ↑ 2.0 1 52,339

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.008..0.010 rows=1 loops=52,339)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
33. 0.011 0.023 ↑ 1.0 7 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
34. 0.012 0.012 ↑ 1.0 7 1

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

35. 32.853 868.726 ↓ 8.8 6,611 1

Sort (cost=10,676.02..10,677.90 rows=753 width=463) (actual time=863.095..868.726 rows=6,611 loops=1)

  • Sort Key: empresas_sucursales_1.nro_patronal
  • Sort Method: quicksort Memory: 4554kB
36. 54.969 835.873 ↓ 8.8 6,611 1

Nested Loop Left Join (cost=14.41..10,640.04 rows=753 width=463) (actual time=0.896..835.873 rows=6,611 loops=1)

37. 42.707 496.631 ↓ 8.8 6,611 1

Nested Loop Left Join (cost=14.41..4,940.23 rows=753 width=443) (actual time=0.769..496.631 rows=6,611 loops=1)

38. 43.191 401.036 ↓ 8.8 6,611 1

Nested Loop Left Join (cost=14.41..4,909.52 rows=753 width=436) (actual time=0.736..401.036 rows=6,611 loops=1)

39. 14.193 318.179 ↓ 8.8 6,611 1

Hash Left Join (cost=14.41..4,858.81 rows=753 width=382) (actual time=0.694..318.179 rows=6,611 loops=1)

  • Hash Cond: (empresas_sucursales_1.distrito_id = distritos_1.id)
40. 19.798 303.944 ↓ 8.8 6,611 1

Hash Left Join (cost=13.00..4,847.06 rows=753 width=371) (actual time=0.640..303.944 rows=6,611 loops=1)

  • Hash Cond: (empresas_sucursales_1.city_id = city_1.id)
41. 27.538 283.642 ↓ 8.8 6,611 1

Nested Loop Left Join (cost=0.29..4,824.03 rows=753 width=335) (actual time=0.119..283.642 rows=6,611 loops=1)

42. 47.014 242.882 ↓ 8.8 6,611 1

Nested Loop Left Join (cost=0.29..4,803.17 rows=753 width=321) (actual time=0.111..242.882 rows=6,611 loops=1)

43. 30.467 149.591 ↓ 8.8 6,611 1

Nested Loop (cost=0.29..4,782.32 rows=753 width=306) (actual time=0.049..149.591 rows=6,611 loops=1)

44. 39.324 39.324 ↓ 8.8 6,650 1

Seq Scan on empresas_sucursales empresas_sucursales_1 (cost=0.00..3,035.72 rows=753 width=302) (actual time=0.019..39.324 rows=6,650 loops=1)

  • Filter: ((type <> 1) AND (type <> 1))
  • Rows Removed by Filter: 52341
45. 79.800 79.800 ↑ 1.0 1 6,650

Index Scan using empresas_pk on empresas emp_1 (cost=0.29..2.31 rows=1 width=20) (actual time=0.010..0.012 rows=1 loops=6,650)

  • Index Cond: (id = empresas_sucursales_1.empresa_id)
  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
  • Rows Removed by Filter: 0
46. 46.277 46.277 ↑ 1.0 1 6,611

Index Scan using empresas_types_id_idx on empresas_types empresas_types_1 (cost=0.00..0.02 rows=1 width=23) (actual time=0.005..0.007 rows=1 loops=6,611)

  • Index Cond: (emp_1.type = id)
47. 13.222 13.222 ↓ 0.0 0 6,611

Index Scan using empresas_categorias_id_categoria_empresa_idx on empresas_categorias empresas_categorias_1 (cost=0.00..0.02 rows=1 width=18) (actual time=0.002..0.002 rows=0 loops=6,611)

  • Index Cond: (emp_1.id_categoria_empresa = id_categoria_empresa)
48. 0.271 0.504 ↑ 1.0 254 1

Hash (cost=9.54..9.54 rows=254 width=40) (actual time=0.504..0.504 rows=254 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
49. 0.233 0.233 ↑ 1.0 254 1

Seq Scan on city city_1 (cost=0.00..9.54 rows=254 width=40) (actual time=0.007..0.233 rows=254 loops=1)

50. 0.020 0.042 ↑ 1.0 18 1

Hash (cost=1.18..1.18 rows=18 width=19) (actual time=0.042..0.042 rows=18 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
51. 0.022 0.022 ↑ 1.0 18 1

Seq Scan on distritos distritos_1 (cost=0.00..1.18 rows=18 width=19) (actual time=0.005..0.022 rows=18 loops=1)

52. 39.666 39.666 ↑ 1.0 1 6,611

Index Scan using actividad_econ_id_activ_econ_idx on actividad_econ actividad_econ_1 (cost=0.00..0.06 rows=1 width=58) (actual time=0.005..0.006 rows=1 loops=6,611)

  • Index Cond: (empresas_sucursales_1.id_activ_econ = id_activ_econ)
53. 52.888 52.888 ↑ 1.0 1 6,611

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) (actual time=0.007..0.008 rows=1 loops=6,611)

  • Index Cond: (empresas_sucursales_1.type = id)
54. 52.888 52.888 ↑ 1.0 1 6,611

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) (actual time=0.006..0.008 rows=1 loops=6,611)

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

SubPlan (for Nested Loop Left Join)

56. 26.444 231.385 ↑ 1.0 1 6,611

Limit (cost=7.53..7.53 rows=1 width=27) (actual time=0.034..0.035 rows=1 loops=6,611)

57. 66.110 204.941 ↑ 2.0 1 6,611

Sort (cost=7.53..7.53 rows=2 width=27) (actual time=0.031..0.031 rows=1 loops=6,611)

  • Sort Key: cambio_situacion_empresa_1.fecha_creacion, cambio_situacion_empresa_1.id_cambio_situacion_empresa
  • Sort Method: quicksort Memory: 25kB
58. 52.864 138.831 ↑ 2.0 1 6,611

Hash Join (cost=1.57..7.52 rows=2 width=27) (actual time=0.014..0.021 rows=1 loops=6,611)

  • Hash Cond: (cambio_situacion_empresa_1.situacion_act = situacion_emp_1.id_situacion)
59. 85.943 85.943 ↑ 2.0 1 6,611

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) (actual time=0.010..0.013 rows=1 loops=6,611)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
60. 0.014 0.024 ↑ 1.0 7 1

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

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

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

Total runtime : 4,007.000 ms