explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XOWX

Settings
# exclusive inclusive rows x rows loops node
1. 19.816 254,660.606 ↓ 1.1 8,874 1

Append (cost=65,348,279.78..66,304,107.96 rows=8,063 width=635) (actual time=94,211.882..254,660.606 rows=8,874 loops=1)

2. 139.875 94,219.325 ↓ 1.0 7,992 1

Sort (cost=65,348,279.78..65,348,299.64 rows=7,947 width=469) (actual time=94,211.881..94,219.325 rows=7,992 loops=1)

  • Sort Key: empresas_sucursales.nro_patronal
  • Sort Method: quicksort Memory: 4942kB
3. 414.402 94,079.450 ↓ 1.0 7,992 1

Hash Left Join (cost=3,149.46..65,347,764.96 rows=7,947 width=469) (actual time=501.442..94,079.450 rows=7,992 loops=1)

  • Hash Cond: (empresas_sucursales.id_tipo_inscripcion = empresas_tipo_inscripcion.id_tipo_inscripcion)
4. 76.812 1,453.336 ↓ 1.0 7,992 1

Hash Left Join (cost=3,148.40..6,923.81 rows=7,947 width=449) (actual time=489.449..1,453.336 rows=7,992 loops=1)

  • Hash Cond: (empresas_sucursales.type = empresas_sucursales_types.id)
5. 74.617 1,376.507 ↓ 1.0 7,992 1

Hash Left Join (cost=3,147.35..6,813.49 rows=7,947 width=442) (actual time=489.395..1,376.507 rows=7,992 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
6. 58.282 1,296.137 ↓ 1.0 7,992 1

Hash Left Join (cost=3,121.92..6,678.79 rows=7,947 width=388) (actual time=483.614..1,296.137 rows=7,992 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
7. 67.135 1,237.839 ↓ 1.0 7,992 1

Hash Left Join (cost=3,120.68..6,568.28 rows=7,947 width=377) (actual time=483.566..1,237.839 rows=7,992 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
8. 37.119 1,170.011 ↓ 1.0 7,992 1

Hash Left Join (cost=3,107.97..6,446.65 rows=7,947 width=341) (actual time=482.844..1,170.011 rows=7,992 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
9. 53.428 1,132.875 ↓ 1.0 7,992 1

Hash Left Join (cost=3,106.88..6,411.16 rows=7,947 width=327) (actual time=482.803..1,132.875 rows=7,992 loops=1)

  • Hash Cond: (emp.type = empresas_types.id)
10. 140.944 1,079.377 ↓ 1.0 7,992 1

Hash Join (cost=3,105.20..6,300.22 rows=7,947 width=312) (actual time=482.696..1,079.377 rows=7,992 loops=1)

  • Hash Cond: (empresas_sucursales.empresa_id = emp.id)
11. 455.848 455.848 ↓ 1.0 7,992 1

Seq Scan on empresas_sucursales (cost=0.00..3,036.07 rows=7,947 width=239) (actual time=0.039..455.848 rows=7,992 loops=1)

  • Filter: ((type = 1) AND (distrito_id = 35))
  • Rows Removed by Filter: 51017
12. 116.394 482.585 ↓ 1.0 52,214 1

Hash (cost=2,452.64..2,452.64 rows=52,205 width=81) (actual time=482.585..482.585 rows=52,214 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 5845kB
13. 366.191 366.191 ↓ 1.0 52,214 1

Seq Scan on empresas emp (cost=0.00..2,452.64 rows=52,205 width=81) (actual time=0.014..366.191 rows=52,214 loops=1)

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

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

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

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

16. 0.007 0.017 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=18) (actual time=0.017..0.017 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.006..0.010 rows=4 loops=1)

18. 0.370 0.693 ↑ 1.0 254 1

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

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

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

20. 0.004 0.016 ↑ 1.0 1 1

Hash (cost=1.23..1.23 rows=1 width=19) (actual time=0.016..0.016 rows=1 loops=1)

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

Seq Scan on distritos (cost=0.00..1.23 rows=1 width=19) (actual time=0.010..0.012 rows=1 loops=1)

  • Filter: (id = 35)
  • Rows Removed by Filter: 17
22. 3.024 5.753 ↑ 1.0 730 1

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

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

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

24. 0.005 0.017 ↑ 1.0 1 1

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

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

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

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

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

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

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

28.          

SubPlan (forHash Left Join)

29. 231.768 32,015.952 ↑ 1.0 1 7,992

Aggregate (cost=1,944.87..1,944.88 rows=1 width=8) (actual time=4.003..4.006 rows=1 loops=7,992)

30. 263.736 31,784.184 ↑ 8.6 7 7,992

Nested Loop (cost=0.72..1,944.72 rows=60 width=8) (actual time=0.876..3.977 rows=7 loops=7,992)

31. 231.768 231.768 ↑ 1.0 1 7,992

Index Only Scan using empresas_sucursales_nro_patronal_idx on empresas_sucursales es (cost=0.29..2.31 rows=1 width=4) (actual time=0.026..0.029 rows=1 loops=7,992)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 8
32. 6,410.880 31,288.680 ↑ 8.6 7 7,992

Index Scan using empleados_npatronal_idx on empleados (cost=0.43..1,941.81 rows=60 width=24) (actual time=0.839..3.915 rows=7 loops=7,992)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 2)
  • Rows Removed by Filter: 9
33.          

SubPlan (forIndex Scan)

34. 621.945 24,877.800 ↑ 1.0 1 124,389

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.199..0.200 rows=1 loops=124,389)

35. 2,114.613 24,255.855 ↑ 1.0 1 124,389

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.195..0.195 rows=1 loops=124,389)

  • Sort Key: empleados_movimientos.fecha, empleados_movimientos.id
  • Sort Method: quicksort Memory: 25kB
36. 1,253.802 22,141.242 ↓ 2.0 2 124,389

Result (cost=0.43..14.13 rows=1 width=20) (actual time=0.117..0.178 rows=2 loops=124,389)

  • One-Time Filter: (empleados.empresa_id = emp.id)
37. 15,216.398 20,887.440 ↓ 2.0 2 124,330

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos (cost=0.43..14.13 rows=1 width=20) (actual time=0.112..0.168 rows=2 loops=124,330)

  • Index Cond: (empleado_id = empleados.id)
  • Filter: (NOT (SubPlan 1))
  • Rows Removed by Filter: 0
38.          

SubPlan (forIndex Scan)

39. 5,671.042 5,671.042 ↓ 0.0 0 218,117

Index Scan using multas_id_registro_multado_idx on multas (cost=0.00..4.02 rows=1 width=8) (actual time=0.026..0.026 rows=0 loops=218,117)

  • Index Cond: (id_registro_multado = empleados_movimientos.id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
40. 223.776 17,574.408 ↑ 1.0 1 7,992

Aggregate (cost=2,088.33..2,088.36 rows=1 width=16) (actual time=2.197..2.199 rows=1 loops=7,992)

41. 2,014.659 17,350.632 ↑ 9.2 8 7,992

Index Only Scan using empleados_empresa_id_id_idx on empleados emplea (cost=0.43..2,086.85 rows=74 width=16) (actual time=0.399..2.171 rows=8 loops=7,992)

  • Index Cond: (empresa_id = emp.id)
  • Filter: (SubPlan 5)
  • Rows Removed by Filter: 10
  • Heap Fetches: 174
42.          

SubPlan (forIndex Only Scan)

43. 844.182 15,335.973 ↑ 1.0 1 140,697

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.108..0.109 rows=1 loops=140,697)

44. 2,110.455 14,491.791 ↑ 1.0 1 140,697

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.103..0.103 rows=1 loops=140,697)

  • Sort Key: empleados_movimientos_1.fecha, empleados_movimientos_1.id
  • Sort Method: quicksort Memory: 25kB
45. 7,434.456 12,381.336 ↓ 2.0 2 140,697

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_1 (cost=0.43..14.13 rows=1 width=20) (actual time=0.057..0.088 rows=2 loops=140,697)

  • Index Cond: (empleado_id = emplea.id)
  • Filter: (NOT (SubPlan 4))
  • Rows Removed by Filter: 0
46.          

SubPlan (forIndex Scan)

47. 4,946.880 4,946.880 ↓ 0.0 0 247,344

Index Scan using multas_id_registro_multado_idx on multas multas_1 (cost=0.00..4.02 rows=1 width=8) (actual time=0.020..0.020 rows=0 loops=247,344)

  • Index Cond: (id_registro_multado = empleados_movimientos_1.id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
48. 207.792 21,370.608 ↑ 1.0 1 7,992

Aggregate (cost=2,092.40..2,092.41 rows=1 width=8) (actual time=2.673..2.674 rows=1 loops=7,992)

49. 159.840 21,162.816 ↑ 7.8 4 7,992

Nested Loop (cost=1.15..2,092.33 rows=31 width=8) (actual time=0.504..2.648 rows=4 loops=7,992)

50. 247.752 247.752 ↑ 1.0 1 7,992

Index Only Scan using empresas_sucursales_nro_patronal_idx on empresas_sucursales es_1 (cost=0.29..2.31 rows=1 width=4) (actual time=0.028..0.031 rows=1 loops=7,992)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 8
51. 391.902 20,755.224 ↑ 7.8 4 7,992

Nested Loop (cost=0.86..2,089.71 rows=31 width=16) (actual time=0.464..2.597 rows=4 loops=7,992)

52. 1,855.089 16,159.824 ↑ 8.6 7 7,992

Index Scan using empleados_npatronal_idx on empleados empleados_1 (cost=0.43..1,941.81 rows=60 width=24) (actual time=0.309..2.022 rows=7 loops=7,992)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 8)
  • Rows Removed by Filter: 9
53.          

SubPlan (forIndex Scan)

54. 746.334 14,304.735 ↑ 1.0 1 124,389

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.114..0.115 rows=1 loops=124,389)

55. 1,741.446 13,558.401 ↑ 1.0 1 124,389

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.109..0.109 rows=1 loops=124,389)

  • Sort Key: empleados_movimientos_2.fecha, empleados_movimientos_2.id
  • Sort Method: quicksort Memory: 25kB
56. 1,497.565 11,816.955 ↓ 2.0 2 124,389

Result (cost=0.43..14.13 rows=1 width=20) (actual time=0.062..0.095 rows=2 loops=124,389)

  • One-Time Filter: (empleados_1.empresa_id = emp.id)
57. 6,175.167 10,319.390 ↓ 2.0 2 124,330

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_2 (cost=0.43..14.13 rows=1 width=20) (actual time=0.057..0.083 rows=2 loops=124,330)

  • Index Cond: (empleado_id = empleados_1.id)
  • Filter: (NOT (SubPlan 7))
  • Rows Removed by Filter: 0
58.          

SubPlan (forIndex Scan)

59. 4,144.223 4,144.223 ↓ 0.0 0 218,117

Index Scan using multas_id_registro_multado_idx on multas multas_2 (cost=0.00..4.02 rows=1 width=8) (actual time=0.019..0.019 rows=0 loops=218,117)

  • Index Cond: (id_registro_multado = empleados_movimientos_2.id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
60. 4,203.498 4,203.498 ↑ 1.0 1 53,891

Index Only Scan using persons_id_sexo_idx on persons (cost=0.43..2.46 rows=1 width=8) (actual time=0.077..0.078 rows=1 loops=53,891)

  • Index Cond: ((id = empleados_1.persona_id) AND (sexo = 'M'::text))
  • Heap Fetches: 1437
61. 103.896 19,788.192 ↑ 1.0 1 7,992

Aggregate (cost=2,092.38..2,092.39 rows=1 width=8) (actual time=2.475..2.476 rows=1 loops=7,992)

62. 167.832 19,684.296 ↑ 14.5 2 7,992

Nested Loop (cost=1.15..2,092.31 rows=29 width=8) (actual time=0.675..2.463 rows=2 loops=7,992)

63. 191.808 191.808 ↑ 1.0 1 7,992

Index Only Scan using empresas_sucursales_nro_patronal_idx on empresas_sucursales es_2 (cost=0.29..2.31 rows=1 width=4) (actual time=0.021..0.024 rows=1 loops=7,992)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 8
64. 421.670 19,324.656 ↑ 14.5 2 7,992

Nested Loop (cost=0.86..2,089.71 rows=29 width=16) (actual time=0.639..2.418 rows=2 loops=7,992)

65. 1,804.059 16,855.128 ↑ 8.6 7 7,992

Index Scan using empleados_npatronal_idx on empleados empleados_2 (cost=0.43..1,941.81 rows=60 width=24) (actual time=0.315..2.109 rows=7 loops=7,992)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 11)
  • Rows Removed by Filter: 9
66.          

SubPlan (forIndex Scan)

67. 746.334 15,051.069 ↑ 1.0 1 124,389

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.120..0.121 rows=1 loops=124,389)

68. 1,865.835 14,304.735 ↑ 1.0 1 124,389

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.115..0.115 rows=1 loops=124,389)

  • Sort Key: empleados_movimientos_3.fecha, empleados_movimientos_3.id
  • Sort Method: quicksort Memory: 25kB
69. 1,622.190 12,438.900 ↓ 2.0 2 124,389

Result (cost=0.43..14.13 rows=1 width=20) (actual time=0.064..0.100 rows=2 loops=124,389)

  • One-Time Filter: (empleados_2.empresa_id = emp.id)
70. 6,454.370 10,816.710 ↓ 2.0 2 124,330

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_3 (cost=0.43..14.13 rows=1 width=20) (actual time=0.058..0.087 rows=2 loops=124,330)

  • Index Cond: (empleado_id = empleados_2.id)
  • Filter: (NOT (SubPlan 10))
  • Rows Removed by Filter: 0
71.          

SubPlan (forIndex Scan)

72. 4,362.340 4,362.340 ↓ 0.0 0 218,117

Index Scan using multas_id_registro_multado_idx on multas multas_3 (cost=0.00..4.02 rows=1 width=8) (actual time=0.020..0.020 rows=0 loops=218,117)

  • Index Cond: (id_registro_multado = empleados_movimientos_3.id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
73. 2,047.858 2,047.858 ↓ 0.0 0 53,891

Index Only Scan using persons_id_sexo_idx on persons persons_1 (cost=0.43..2.46 rows=1 width=8) (actual time=0.037..0.038 rows=0 loops=53,891)

  • Index Cond: ((id = empleados_2.persona_id) AND (sexo = 'F'::text))
  • Heap Fetches: 821
74. 63.936 1,462.536 ↑ 1.0 1 7,992

Limit (cost=0.42..4.02 rows=1 width=27) (actual time=0.181..0.183 rows=1 loops=7,992)

75. 133.480 1,398.600 ↑ 2.0 1 7,992

Nested Loop (cost=0.42..7.62 rows=2 width=27) (actual time=0.175..0.175 rows=1 loops=7,992)

  • Join Filter: (cambio_situacion_empresa.situacion_act = situacion_emp.id_situacion)
  • Rows Removed by Join Filter: 3
76. 1,198.800 1,198.800 ↑ 2.0 1 7,992

Index Scan using cambio_situacion_empresa_nro_patronal_fecha_creacion_id_cam_idx on cambio_situacion_empresa (cost=0.42..6.32 rows=2 width=20) (actual time=0.150..0.150 rows=1 loops=7,992)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
77. 66.293 66.320 ↑ 1.4 5 6,632

Materialize (cost=0.00..1.10 rows=7 width=15) (actual time=0.003..0.010 rows=5 loops=6,632)

78. 0.027 0.027 ↑ 1.0 7 1

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

79. 7.939 160,421.465 ↓ 7.6 882 1

Sort (cost=955,727.40..955,727.69 rows=116 width=471) (actual time=160,420.695..160,421.465 rows=882 loops=1)

  • Sort Key: empresas_sucursales_1.nro_patronal
  • Sort Method: quicksort Memory: 642kB
80. 33.953 160,413.526 ↓ 7.6 882 1

Nested Loop Left Join (cost=13.29..955,723.42 rows=116 width=471) (actual time=11.872..160,413.526 rows=882 loops=1)

  • Join Filter: (empresas_sucursales_1.id_tipo_inscripcion = empresas_tipo_inscripcion_1.id_tipo_inscripcion)
  • Rows Removed by Join Filter: 1764
81. 14.728 727.871 ↓ 7.6 882 1

Nested Loop Left Join (cost=13.29..1,957.91 rows=116 width=451) (actual time=1.074..727.871 rows=882 loops=1)

  • Join Filter: (empresas_sucursales_1.type = empresas_sucursales_types_1.id)
  • Rows Removed by Join Filter: 1764
82. 13.171 709.615 ↓ 7.6 882 1

Nested Loop Left Join (cost=13.29..1,951.65 rows=116 width=444) (actual time=1.040..709.615 rows=882 loops=1)

83. 13.590 657.636 ↓ 7.6 882 1

Nested Loop Left Join (cost=13.29..1,918.46 rows=116 width=390) (actual time=0.874..657.636 rows=882 loops=1)

  • Join Filter: (empresas_sucursales_1.distrito_id = distritos_1.id)
84. 5.460 629.052 ↓ 7.6 882 1

Hash Left Join (cost=13.29..1,915.50 rows=116 width=379) (actual time=0.852..629.052 rows=882 loops=1)

  • Hash Cond: (empresas_sucursales_1.city_id = city_1.id)
85. 5.661 622.978 ↓ 7.6 882 1

Nested Loop Left Join (cost=0.57..1,901.20 rows=116 width=343) (actual time=0.214..622.978 rows=882 loops=1)

86. 26.283 585.565 ↓ 7.6 882 1

Nested Loop Left Join (cost=0.57..1,897.99 rows=116 width=329) (actual time=0.205..585.565 rows=882 loops=1)

87. 13.722 536.350 ↓ 7.6 882 1

Nested Loop (cost=0.57..1,894.77 rows=116 width=314) (actual time=0.155..536.350 rows=882 loops=1)

88. 341.552 341.552 ↓ 7.7 892 1

Index Scan using empresas_sucursales_type_idx on empresas_sucursales empresas_sucursales_1 (cost=0.28..1,466.78 rows=116 width=302) (actual time=0.099..341.552 rows=892 loops=1)

  • Filter: (distrito_id = 35)
  • Rows Removed by Filter: 5760
89. 181.076 181.076 ↑ 1.0 1 892

Index Scan using empresas_pk on empresas emp_1 (cost=0.29..3.68 rows=1 width=20) (actual time=0.197..0.203 rows=1 loops=892)

  • 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
90. 22.932 22.932 ↑ 1.0 1 882

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.024..0.026 rows=1 loops=882)

  • Index Cond: (emp_1.type = id)
91. 31.752 31.752 ↓ 0.0 0 882

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.036..0.036 rows=0 loops=882)

  • Index Cond: (emp_1.id_categoria_empresa = id_categoria_empresa)
92. 0.329 0.614 ↑ 1.0 254 1

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

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

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

94. 14.979 14.994 ↑ 1.0 1 882

Materialize (cost=0.00..1.23 rows=1 width=19) (actual time=0.001..0.017 rows=1 loops=882)

95. 0.015 0.015 ↑ 1.0 1 1

Seq Scan on distritos distritos_1 (cost=0.00..1.23 rows=1 width=19) (actual time=0.010..0.015 rows=1 loops=1)

  • Filter: (id = 35)
  • Rows Removed by Filter: 17
96. 38.808 38.808 ↑ 1.0 1 882

Index Scan using actividad_econ_id_activ_econ_idx on actividad_econ actividad_econ_1 (cost=0.00..0.28 rows=1 width=58) (actual time=0.035..0.044 rows=1 loops=882)

  • Index Cond: (empresas_sucursales_1.id_activ_econ = id_activ_econ)
97. 3.507 3.528 ↑ 1.0 3 882

Materialize (cost=0.00..1.04 rows=3 width=23) (actual time=0.001..0.004 rows=3 loops=882)

98. 0.021 0.021 ↑ 1.0 3 1

Seq Scan on empresas_sucursales_types empresas_sucursales_types_1 (cost=0.00..1.03 rows=3 width=23) (actual time=0.016..0.021 rows=3 loops=1)

99. 7.921 7.938 ↑ 1.0 3 882

Materialize (cost=0.00..1.04 rows=3 width=24) (actual time=0.006..0.009 rows=3 loops=882)

100. 0.017 0.017 ↑ 1.0 3 1

Seq Scan on empresas_tipo_inscripcion empresas_tipo_inscripcion_1 (cost=0.00..1.03 rows=3 width=24) (actual time=0.013..0.017 rows=3 loops=1)

101.          

SubPlan (forNested Loop Left Join)

102. 29.988 6,333.642 ↑ 1.0 1 882

Aggregate (cost=1,944.87..1,944.88 rows=1 width=8) (actual time=7.171..7.181 rows=1 loops=882)

103. 59.094 6,303.654 ↑ 4.3 14 882

Nested Loop (cost=0.72..1,944.72 rows=60 width=8) (actual time=0.862..7.147 rows=14 loops=882)

104. 41.454 41.454 ↑ 1.0 1 882

Index Only Scan using empresas_sucursales_nro_patronal_idx on empresas_sucursales es_3 (cost=0.29..2.31 rows=1 width=4) (actual time=0.045..0.047 rows=1 loops=882)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 7
105. 1,661.916 6,203.106 ↑ 4.3 14 882

Index Scan using empleados_npatronal_idx on empleados empleados_3 (cost=0.43..1,941.81 rows=60 width=24) (actual time=0.803..7.033 rows=14 loops=882)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 15)
  • Rows Removed by Filter: 19
106.          

SubPlan (forIndex Scan)

107. 117.192 4,541.190 ↑ 1.0 1 29,298

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.154..0.155 rows=1 loops=29,298)

108. 439.470 4,423.998 ↑ 1.0 1 29,298

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.151..0.151 rows=1 loops=29,298)

  • Sort Key: empleados_movimientos_4.fecha, empleados_movimientos_4.id
  • Sort Method: quicksort Memory: 25kB
109. 326.528 3,984.528 ↓ 2.0 2 29,298

Result (cost=0.43..14.13 rows=1 width=20) (actual time=0.088..0.136 rows=2 loops=29,298)

  • One-Time Filter: (empleados_3.empresa_id = emp_1.id)
110. 2,563.228 3,658.000 ↓ 2.0 2 29,264

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_4 (cost=0.43..14.13 rows=1 width=20) (actual time=0.083..0.125 rows=2 loops=29,264)

  • Index Cond: (empleado_id = empleados_3.id)
  • Filter: (NOT (SubPlan 14))
  • Rows Removed by Filter: 0
111.          

SubPlan (forIndex Scan)

112. 1,094.772 1,094.772 ↓ 0.0 0 52,132

Index Scan using multas_id_registro_multado_idx on multas multas_4 (cost=0.00..4.02 rows=1 width=8) (actual time=0.021..0.021 rows=0 loops=52,132)

  • Index Cond: (id_registro_multado = empleados_movimientos_4.id)
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
113. 845.838 142,709.364 ↑ 1.0 1 882

Aggregate (cost=2,088.33..2,088.36 rows=1 width=16) (actual time=161.801..161.802 rows=1 loops=882)

114. 6,643.901 141,863.526 ↓ 6.6 492 882

Index Only Scan using empleados_empresa_id_id_idx on empleados emplea_1 (cost=0.43..2,086.85 rows=74 width=16) (actual time=1.460..160.843 rows=492 loops=882)

  • Index Cond: (empresa_id = emp_1.id)
  • Filter: (SubPlan 18)
  • Rows Removed by Filter: 735
  • Heap Fetches: 1254
115.          

SubPlan (forIndex Only Scan)

116. 4,327.028 135,219.625 ↑ 1.0 1 1,081,757

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.124..0.125 rows=1 loops=1,081,757)

117. 15,144.598 130,892.597 ↑ 1.0 1 1,081,757

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.121..0.121 rows=1 loops=1,081,757)

  • Sort Key: empleados_movimientos_5.fecha, empleados_movimientos_5.id
  • Sort Method: quicksort Memory: 25kB
118. 74,963.668 115,747.999 ↓ 2.0 2 1,081,757

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_5 (cost=0.43..14.13 rows=1 width=20) (actual time=0.067..0.107 rows=2 loops=1,081,757)

  • Index Cond: (empleado_id = emplea_1.id)
  • Filter: (NOT (SubPlan 17))
  • Rows Removed by Filter: 0
119.          

SubPlan (forIndex Scan)

120. 40,784.331 40,784.331 ↓ 0.0 0 1,942,111

Index Scan using multas_id_registro_multado_idx on multas multas_5 (cost=0.00..4.02 rows=1 width=8) (actual time=0.021..0.021 rows=0 loops=1,942,111)

  • Index Cond: (id_registro_multado = empleados_movimientos_5.id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
121. 24.696 5,870.592 ↑ 1.0 1 882

Aggregate (cost=2,092.40..2,092.41 rows=1 width=8) (actual time=6.655..6.656 rows=1 loops=882)

122. 23.814 5,845.896 ↑ 3.1 10 882

Nested Loop (cost=1.15..2,092.33 rows=31 width=8) (actual time=0.702..6.628 rows=10 loops=882)

123. 18.522 18.522 ↑ 1.0 1 882

Index Only Scan using empresas_sucursales_nro_patronal_idx on empresas_sucursales es_4 (cost=0.29..2.31 rows=1 width=4) (actual time=0.019..0.021 rows=1 loops=882)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 7
124. 85.234 5,803.560 ↑ 3.1 10 882

Nested Loop (cost=0.86..2,089.71 rows=31 width=16) (actual time=0.674..6.580 rows=10 loops=882)

125. 446.988 4,109.238 ↑ 4.3 14 882

Index Scan using empleados_npatronal_idx on empleados empleados_4 (cost=0.43..1,941.81 rows=60 width=24) (actual time=0.359..4.659 rows=14 loops=882)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 21)
  • Rows Removed by Filter: 19
126.          

SubPlan (forIndex Scan)

127. 146.490 3,662.250 ↑ 1.0 1 29,298

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.124..0.125 rows=1 loops=29,298)

128. 439.470 3,515.760 ↑ 1.0 1 29,298

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.120..0.120 rows=1 loops=29,298)

  • Sort Key: empleados_movimientos_6.fecha, empleados_movimientos_6.id
  • Sort Method: quicksort Memory: 25kB
129. 354.738 3,076.290 ↓ 2.0 2 29,298

Result (cost=0.43..14.13 rows=1 width=20) (actual time=0.071..0.105 rows=2 loops=29,298)

  • One-Time Filter: (empleados_4.empresa_id = emp_1.id)
130. 1,678.912 2,721.552 ↓ 2.0 2 29,264

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_6 (cost=0.43..14.13 rows=1 width=20) (actual time=0.065..0.093 rows=2 loops=29,264)

  • Index Cond: (empleado_id = empleados_4.id)
  • Filter: (NOT (SubPlan 20))
  • Rows Removed by Filter: 0
131.          

SubPlan (forIndex Scan)

132. 1,042.640 1,042.640 ↓ 0.0 0 52,132

Index Scan using multas_id_registro_multado_idx on multas multas_6 (cost=0.00..4.02 rows=1 width=8) (actual time=0.020..0.020 rows=0 loops=52,132)

  • Index Cond: (id_registro_multado = empleados_movimientos_6.id)
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
133. 1,609.088 1,609.088 ↑ 1.0 1 12,571

Index Only Scan using persons_id_sexo_idx on persons persons_2 (cost=0.43..2.46 rows=1 width=8) (actual time=0.125..0.128 rows=1 loops=12,571)

  • Index Cond: ((id = empleados_4.persona_id) AND (sexo = 'M'::text))
  • Heap Fetches: 398
134. 11.466 4,499.082 ↑ 1.0 1 882

Aggregate (cost=2,092.38..2,092.39 rows=1 width=8) (actual time=5.100..5.101 rows=1 loops=882)

135. 37.044 4,487.616 ↑ 5.8 5 882

Nested Loop (cost=1.15..2,092.31 rows=29 width=8) (actual time=1.145..5.088 rows=5 loops=882)

136. 22.050 22.050 ↑ 1.0 1 882

Index Only Scan using empresas_sucursales_nro_patronal_idx on empresas_sucursales es_5 (cost=0.29..2.31 rows=1 width=4) (actual time=0.023..0.025 rows=1 loops=882)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 7
137. 78.175 4,428.522 ↑ 5.8 5 882

Nested Loop (cost=0.86..2,089.71 rows=29 width=16) (actual time=1.096..5.021 rows=5 loops=882)

138. 407.070 3,834.936 ↑ 4.3 14 882

Index Scan using empleados_npatronal_idx on empleados empleados_5 (cost=0.43..1,941.81 rows=60 width=24) (actual time=0.378..4.348 rows=14 loops=882)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 24)
  • Rows Removed by Filter: 19
139.          

SubPlan (forIndex Scan)

140. 117.192 3,427.866 ↑ 1.0 1 29,298

Limit (cost=14.14..14.15 rows=1 width=20) (actual time=0.117..0.117 rows=1 loops=29,298)

141. 410.172 3,310.674 ↑ 1.0 1 29,298

Sort (cost=14.14..14.15 rows=1 width=20) (actual time=0.113..0.113 rows=1 loops=29,298)

  • Sort Key: empleados_movimientos_7.fecha, empleados_movimientos_7.id
  • Sort Method: quicksort Memory: 25kB
142. 296.006 2,900.502 ↓ 2.0 2 29,298

Result (cost=0.43..14.13 rows=1 width=20) (actual time=0.066..0.099 rows=2 loops=29,298)

  • One-Time Filter: (empleados_5.empresa_id = emp_1.id)
143. 1,666.120 2,604.496 ↓ 2.0 2 29,264

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos empleados_movimientos_7 (cost=0.43..14.13 rows=1 width=20) (actual time=0.061..0.089 rows=2 loops=29,264)

  • Index Cond: (empleado_id = empleados_5.id)
  • Filter: (NOT (SubPlan 23))
  • Rows Removed by Filter: 0
144.          

SubPlan (forIndex Scan)

145. 938.376 938.376 ↓ 0.0 0 52,132

Index Scan using multas_id_registro_multado_idx on multas multas_7 (cost=0.00..4.02 rows=1 width=8) (actual time=0.018..0.018 rows=0 loops=52,132)

  • Index Cond: (id_registro_multado = empleados_movimientos_7.id)
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0
146. 515.411 515.411 ↓ 0.0 0 12,571

Index Only Scan using persons_id_sexo_idx on persons persons_3 (cost=0.43..2.46 rows=1 width=8) (actual time=0.039..0.041 rows=0 loops=12,571)

  • Index Cond: ((id = empleados_5.persona_id) AND (sexo = 'F'::text))
  • Heap Fetches: 185
147. 2.646 231.084 ↑ 1.0 1 882

Limit (cost=0.42..4.02 rows=1 width=27) (actual time=0.261..0.262 rows=1 loops=882)

148. 14.412 228.438 ↑ 2.0 1 882

Nested Loop (cost=0.42..7.62 rows=2 width=27) (actual time=0.259..0.259 rows=1 loops=882)

  • Join Filter: (cambio_situacion_empresa_1.situacion_act = situacion_emp_1.id_situacion)
  • Rows Removed by Join Filter: 4
149. 209.916 209.916 ↑ 2.0 1 882

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.32 rows=2 width=20) (actual time=0.238..0.238 rows=1 loops=882)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
150. 4.097 4.110 ↑ 1.4 5 822

Materialize (cost=0.00..1.10 rows=7 width=15) (actual time=0.001..0.005 rows=5 loops=822)

151. 0.013 0.013 ↑ 1.2 6 1

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