explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vokT : 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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 82.932 240,955.810 ↓ 1.1 55,556 1

Append (cost=3,088.37..313,752,265.12 rows=50,527 width=1,130) (actual time=111.405..240,955.810 rows=55,556 loops=1)

2. 618.791 116,136.799 ↓ 1.0 49,973 1

Hash Left Join (cost=3,088.37..310,194,564.69 rows=49,955 width=964) (actual time=111.402..116,136.799 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.type = empresas_sucursales_types.id)
3. 106.192 879.927 ↓ 1.0 49,973 1

Hash Left Join (cost=3,087.32..9,555.69 rows=49,955 width=940) (actual time=111.108..879.927 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.id_activ_econ = actividad_econ.id_activ_econ)
4. 97.482 772.598 ↓ 1.0 49,973 1

Hash Left Join (cost=3,062.57..8,844.08 rows=49,955 width=886) (actual time=109.963..772.598 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.distrito_id = distritos.id)
5. 101.747 675.082 ↓ 1.0 49,973 1

Hash Left Join (cost=3,061.10..8,156.10 rows=49,955 width=876) (actual time=109.920..675.082 rows=49,973 loops=1)

  • Hash Cond: (empresas_sucursales.city_id = city.id)
6. 84.356 572.891 ↓ 1.0 49,973 1

Hash Left Join (cost=3,048.45..7,459.08 rows=49,955 width=840) (actual time=109.467..572.891 rows=49,973 loops=1)

  • Hash Cond: (emp.id_categoria_empresa = empresas_categorias.id_categoria_empresa)
7. 95.413 488.517 ↓ 1.0 49,973 1

Hash Left Join (cost=3,035.30..7,253.70 rows=49,955 width=324) (actual time=109.441..488.517 rows=49,973 loops=1)

  • Hash Cond: (emp.type = empresas_types.id)
8. 189.863 393.052 ↓ 1.0 49,973 1

Hash Join (cost=3,033.71..6,645.81 rows=49,955 width=311) (actual time=109.373..393.052 rows=49,973 loops=1)

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

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

  • Filter: (type = 1)
  • Rows Removed by Filter: 5622
10. 47.667 109.326 ↓ 1.0 49,834 1

Hash (cost=2,410.94..2,410.94 rows=49,822 width=82) (actual time=109.326..109.326 rows=49,834 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 5570kB
11. 61.659 61.659 ↓ 1.0 49,834 1

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

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

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

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

14. 0.005 0.018 ↑ 35.0 4 1

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

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

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

16. 0.210 0.444 ↑ 1.0 251 1

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

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

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

18. 0.015 0.034 ↑ 1.2 18 1

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

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

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

20. 0.573 1.137 ↑ 1.0 700 1

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

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

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

22. 0.003 0.019 ↑ 1.0 1 1

Hash (cost=1.04..1.04 rows=1 width=40) (actual time=0.019..0.019 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
23. 0.016 0.016 ↑ 1.0 1 1

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

  • Filter: (id = 1)
  • Rows Removed by Filter: 2
24.          

SubPlan (forHash Left Join)

25. 599.676 30,533.503 ↑ 1.0 1 49,973

Aggregate (cost=1,410.13..1,410.14 rows=1 width=8) (actual time=0.610..0.611 rows=1 loops=49,973)

26. 999.460 29,933.827 ↑ 5.8 10 49,973

Nested Loop (cost=0.72..1,409.98 rows=58 width=8) (actual time=0.067..0.599 rows=10 loops=49,973)

27. 249.865 249.865 ↑ 1.0 1 49,973

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es (cost=0.29..6.31 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=49,973)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 64
28. 4,404.840 28,684.502 ↑ 5.8 10 49,973

Index Scan using empleados_npatronal_id_idx on empleados (cost=0.43..1,403.10 rows=58 width=24) (actual time=0.059..0.574 rows=10 loops=49,973)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 1)
  • Rows Removed by Filter: 12
29.          

SubPlan (forIndex Scan)

30. 2,207.242 24,279.662 ↑ 1.0 1 1,103,621

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.022..0.022 rows=1 loops=1,103,621)

31. 5,518.105 22,072.420 ↑ 2.0 1 1,103,621

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.020..0.020 rows=1 loops=1,103,621)

  • Sort Key: empleados_movimientos.fecha, empleados_movimientos.id
  • Sort Method: quicksort Memory: 25kB
32. 5,520.725 16,554.315 ↑ 1.0 2 1,103,621

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.009..0.015 rows=2 loops=1,103,621)

  • One-Time Filter: (empleados.empresa_id = emp.id)
33. 11,033.590 11,033.590 ↑ 1.0 2 1,103,359

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos (cost=0.00..9.04 rows=2 width=20) (actual time=0.007..0.010 rows=2 loops=1,103,359)

  • Index Cond: (empleado_id = empleados.id)
  • Rows Removed by Index Recheck: 0
34. 749.595 23,687.202 ↑ 1.0 1 49,973

Aggregate (cost=1,272.59..1,272.62 rows=1 width=16) (actual time=0.473..0.474 rows=1 loops=49,973)

35. 3,946.369 22,937.607 ↑ 5.8 12 49,973

Index Only Scan using empleados_empresa_id_id_idx on empleados emplea (cost=0.43..1,271.19 rows=70 width=16) (actual time=0.040..0.459 rows=12 loops=49,973)

  • Index Cond: (empresa_id = emp.id)
  • Filter: (SubPlan 3)
  • Rows Removed by Filter: 15
  • Heap Fetches: 28144
36.          

SubPlan (forIndex Only Scan)

37. 2,713.034 18,991.238 ↑ 1.0 1 1,356,517

Limit (cost=9.05..9.06 rows=1 width=20) (actual time=0.014..0.014 rows=1 loops=1,356,517)

38. 6,782.585 16,278.204 ↑ 2.0 1 1,356,517

Sort (cost=9.05..9.06 rows=2 width=20) (actual time=0.012..0.012 rows=1 loops=1,356,517)

  • Sort Key: empleados_movimientos_1.fecha, empleados_movimientos_1.id
  • Sort Method: quicksort Memory: 25kB
39. 9,495.619 9,495.619 ↑ 1.0 2 1,356,517

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_1 (cost=0.00..9.04 rows=2 width=20) (actual time=0.005..0.007 rows=2 loops=1,356,517)

  • Index Cond: (empleado_id = emplea.id)
  • Rows Removed by Index Recheck: 0
40. 449.757 30,483.530 ↑ 1.0 1 49,973

Aggregate (cost=1,759.76..1,759.77 rows=1 width=8) (actual time=0.609..0.610 rows=1 loops=49,973)

41. 649.649 30,033.773 ↑ 6.3 6 49,973

Nested Loop (cost=0.72..1,759.67 rows=38 width=8) (actual time=0.070..0.601 rows=6 loops=49,973)

42. 199.892 199.892 ↑ 1.0 1 49,973

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es_1 (cost=0.29..6.31 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=49,973)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 63
43. 1,992.635 29,184.232 ↑ 6.3 6 49,973

Nested Loop (cost=0.43..1,752.98 rows=38 width=16) (actual time=0.064..0.584 rows=6 loops=49,973)

44. 3,372.267 23,237.445 ↑ 5.8 10 49,973

Index Scan using empleados_npatronal_id_idx on empleados empleados_1 (cost=0.43..1,403.10 rows=58 width=24) (actual time=0.039..0.465 rows=10 loops=49,973)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 5)
  • Rows Removed by Filter: 12
45.          

SubPlan (forIndex Scan)

46. 2,207.242 19,865.178 ↑ 1.0 1 1,103,621

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.018..0.018 rows=1 loops=1,103,621)

47. 5,518.105 17,657.936 ↑ 2.0 1 1,103,621

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.016..0.016 rows=1 loops=1,103,621)

  • Sort Key: empleados_movimientos_2.fecha, empleados_movimientos_2.id
  • Sort Method: quicksort Memory: 25kB
48. 5,519.677 12,139.831 ↑ 1.0 2 1,103,621

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.006..0.011 rows=2 loops=1,103,621)

  • One-Time Filter: (empleados_1.empresa_id = emp.id)
49. 6,620.154 6,620.154 ↑ 1.0 2 1,103,359

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_2 (cost=0.00..9.04 rows=2 width=20) (actual time=0.004..0.006 rows=2 loops=1,103,359)

  • Index Cond: (empleado_id = empleados_1.id)
  • Rows Removed by Index Recheck: 0
50. 3,954.152 3,954.152 ↑ 1.0 1 494,269

Index Scan using persons_id_idx on persons (cost=0.00..6.02 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=494,269)

  • Index Cond: (id = empleados_1.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'M'::text)
  • Rows Removed by Filter: 0
51. 299.838 27,834.961 ↑ 1.0 1 49,973

Aggregate (cost=1,759.54..1,759.55 rows=1 width=8) (actual time=0.556..0.557 rows=1 loops=49,973)

52. 449.757 27,535.123 ↑ 6.7 3 49,973

Nested Loop (cost=0.72..1,759.49 rows=20 width=8) (actual time=0.108..0.551 rows=3 loops=49,973)

53. 199.892 199.892 ↑ 1.0 1 49,973

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es_2 (cost=0.29..6.31 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=49,973)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 63
54. 1,376.576 26,885.474 ↑ 6.7 3 49,973

Nested Loop (cost=0.43..1,752.98 rows=20 width=16) (actual time=0.101..0.538 rows=3 loops=49,973)

55. 3,172.375 23,037.553 ↑ 5.8 10 49,973

Index Scan using empleados_npatronal_id_idx on empleados empleados_2 (cost=0.43..1,403.10 rows=58 width=24) (actual time=0.040..0.461 rows=10 loops=49,973)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 7)
  • Rows Removed by Filter: 12
56.          

SubPlan (forIndex Scan)

57. 2,207.242 19,865.178 ↑ 1.0 1 1,103,621

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.018..0.018 rows=1 loops=1,103,621)

58. 5,518.105 17,657.936 ↑ 2.0 1 1,103,621

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.016..0.016 rows=1 loops=1,103,621)

  • Sort Key: empleados_movimientos_3.fecha, empleados_movimientos_3.id
  • Sort Method: quicksort Memory: 25kB
59. 5,519.677 12,139.831 ↑ 1.0 2 1,103,621

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.006..0.011 rows=2 loops=1,103,621)

  • One-Time Filter: (empleados_2.empresa_id = emp.id)
60. 6,620.154 6,620.154 ↑ 1.0 2 1,103,359

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_3 (cost=0.00..9.04 rows=2 width=20) (actual time=0.004..0.006 rows=2 loops=1,103,359)

  • Index Cond: (empleado_id = empleados_2.id)
  • Rows Removed by Index Recheck: 0
61. 2,471.345 2,471.345 ↓ 0.0 0 494,269

Index Scan using persons_id_idx on persons persons_1 (cost=0.00..6.02 rows=1 width=8) (actual time=0.004..0.005 rows=0 loops=494,269)

  • Index Cond: (id = empleados_2.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'F'::text)
  • Rows Removed by Filter: 1
62. 99.946 2,098.866 ↑ 1.0 1 49,973

Limit (cost=7.19..7.19 rows=1 width=134) (actual time=0.042..0.042 rows=1 loops=49,973)

63. 249.865 1,998.920 ↑ 1.0 1 49,973

Sort (cost=7.19..7.19 rows=1 width=134) (actual time=0.040..0.040 rows=1 loops=49,973)

  • Sort Key: cambio_situacion_empresa.fecha_creacion, cambio_situacion_empresa.id_cambio_situacion_empresa
  • Sort Method: quicksort Memory: 25kB
64. 617.365 1,749.055 ↑ 1.0 1 49,973

Nested Loop (cost=0.00..7.18 rows=1 width=134) (actual time=0.023..0.035 rows=1 loops=49,973)

  • Join Filter: (cambio_situacion_empresa.situacion_act = situacion_emp.id_situacion)
  • Rows Removed by Join Filter: 7
65. 749.595 749.595 ↑ 1.0 1 49,973

Index Scan using cambio_situacion_empresa_nro_patronal_idx on cambio_situacion_empresa (cost=0.00..6.02 rows=1 width=20) (actual time=0.012..0.015 rows=1 loops=49,973)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
66. 382.095 382.095 ↑ 1.0 7 54,585

Seq Scan on situacion_emp (cost=0.00..1.07 rows=7 width=122) (actual time=0.002..0.007 rows=7 loops=54,585)

67. 116.728 124,736.079 ↓ 9.8 5,583 1

Nested Loop Left Join (cost=27.27..3,557,195.16 rows=572 width=966) (actual time=2.190..124,736.079 rows=5,583 loops=1)

  • Join Filter: (empresas_sucursales_1.type = empresas_sucursales_types_1.id)
  • Rows Removed by Join Filter: 11166
68. 27.611 336.188 ↓ 9.8 5,583 1

Nested Loop Left Join (cost=27.27..5,463.21 rows=572 width=942) (actual time=0.740..336.188 rows=5,583 loops=1)

69. 18.415 269.496 ↓ 9.8 5,583 1

Hash Left Join (cost=27.27..5,402.48 rows=572 width=888) (actual time=0.693..269.496 rows=5,583 loops=1)

  • Hash Cond: (empresas_sucursales_1.distrito_id = distritos_1.id)
70. 16.657 251.031 ↓ 9.8 5,583 1

Hash Left Join (cost=25.80..5,393.14 rows=572 width=878) (actual time=0.631..251.031 rows=5,583 loops=1)

  • Hash Cond: (empresas_sucursales_1.city_id = city_1.id)
71. 12.521 233.896 ↓ 9.8 5,583 1

Hash Left Join (cost=13.15..5,372.66 rows=572 width=842) (actual time=0.141..233.896 rows=5,583 loops=1)

  • Hash Cond: (emp_1.id_categoria_empresa = empresas_categorias_1.id_categoria_empresa)
72. 29.758 221.347 ↓ 9.8 5,583 1

Nested Loop Left Join (cost=0.00..5,357.31 rows=572 width=326) (actual time=0.099..221.347 rows=5,583 loops=1)

73. 27.005 158.091 ↓ 9.8 5,583 1

Nested Loop (cost=0.00..5,341.40 rows=572 width=313) (actual time=0.068..158.091 rows=5,583 loops=1)

74. 35.512 35.512 ↓ 9.8 5,622 1

Seq Scan on empresas_sucursales empresas_sucursales_1 (cost=0.00..2,751.95 rows=572 width=301) (actual time=0.017..35.512 rows=5,622 loops=1)

  • Filter: ((type <> 1) AND (type <> 1))
  • Rows Removed by Filter: 49975
75. 95.574 95.574 ↑ 1.0 1 5,622

Index Scan using empresas_id_idx on empresas emp_1 (cost=0.00..4.52 rows=1 width=20) (actual time=0.015..0.017 rows=1 loops=5,622)

  • 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
76. 33.498 33.498 ↑ 1.0 1 5,583

Index Scan using empresas_types_id_idx on empresas_types empresas_types_1 (cost=0.00..0.02 rows=1 width=21) (actual time=0.004..0.006 rows=1 loops=5,583)

  • Index Cond: (emp_1.type = id)
77. 0.007 0.028 ↑ 35.0 4 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
78. 0.021 0.021 ↑ 35.0 4 1

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

79. 0.222 0.478 ↑ 1.0 251 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
80. 0.256 0.256 ↑ 1.0 251 1

Seq Scan on city city_1 (cost=0.00..9.51 rows=251 width=40) (actual time=0.013..0.256 rows=251 loops=1)

81. 0.015 0.050 ↑ 1.2 18 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
82. 0.035 0.035 ↑ 1.2 18 1

Seq Scan on distritos distritos_1 (cost=0.00..1.21 rows=21 width=18) (actual time=0.020..0.035 rows=18 loops=1)

83. 39.081 39.081 ↑ 1.0 1 5,583

Index Scan using actividad_econ_id_activ_econ_idx on actividad_econ actividad_econ_1 (cost=0.00..0.10 rows=1 width=58) (actual time=0.005..0.007 rows=1 loops=5,583)

  • Index Cond: (empresas_sucursales_1.id_activ_econ = id_activ_econ)
84. 22.319 22.332 ↑ 1.0 3 5,583

Materialize (cost=0.00..1.04 rows=3 width=40) (actual time=0.001..0.004 rows=3 loops=5,583)

85. 0.013 0.013 ↑ 1.0 3 1

Seq Scan on empresas_sucursales_types empresas_sucursales_types_1 (cost=0.00..1.03 rows=3 width=40) (actual time=0.010..0.013 rows=3 loops=1)

86.          

SubPlan (forNested Loop Left Join)

87. 111.660 5,543.919 ↑ 1.0 1 5,583

Aggregate (cost=1,410.13..1,410.14 rows=1 width=8) (actual time=0.992..0.993 rows=1 loops=5,583)

88. 195.405 5,432.259 ↑ 3.2 18 5,583

Nested Loop (cost=0.72..1,409.98 rows=58 width=8) (actual time=0.083..0.973 rows=18 loops=5,583)

89. 39.081 39.081 ↑ 1.0 1 5,583

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es_3 (cost=0.29..6.31 rows=1 width=4) (actual time=0.006..0.007 rows=1 loops=5,583)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 40
90. 917.773 5,197.773 ↑ 3.2 18 5,583

Index Scan using empleados_npatronal_id_idx on empleados empleados_3 (cost=0.43..1,403.10 rows=58 width=24) (actual time=0.072..0.931 rows=18 loops=5,583)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 10)
  • Rows Removed by Filter: 20
91.          

SubPlan (forIndex Scan)

92. 428.000 4,280.000 ↑ 1.0 1 214,000

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.020..0.020 rows=1 loops=214,000)

93. 1,070.000 3,852.000 ↑ 2.0 1 214,000

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.018..0.018 rows=1 loops=214,000)

  • Sort Key: empleados_movimientos_4.fecha, empleados_movimientos_4.id
  • Sort Method: quicksort Memory: 25kB
94. 1,070.272 2,782.000 ↑ 1.0 2 214,000

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.008..0.013 rows=2 loops=214,000)

  • One-Time Filter: (empleados_3.empresa_id = emp_1.id)
95. 1,711.728 1,711.728 ↑ 1.0 2 213,966

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_4 (cost=0.00..9.04 rows=2 width=20) (actual time=0.006..0.008 rows=2 loops=213,966)

  • Index Cond: (empleado_id = empleados_3.id)
  • Rows Removed by Index Recheck: 0
96. 2,400.690 106,596.219 ↑ 1.0 1 5,583

Aggregate (cost=1,272.59..1,272.62 rows=1 width=16) (actual time=19.092..19.093 rows=1 loops=5,583)

97. 12,308.499 104,195.529 ↓ 6.8 475 5,583

Index Only Scan using empleados_empresa_id_id_idx on empleados emplea_1 (cost=0.43..1,271.19 rows=70 width=16) (actual time=0.091..18.663 rows=475 loops=5,583)

  • Index Cond: (empresa_id = emp_1.id)
  • Filter: (SubPlan 12)
  • Rows Removed by Filter: 623
  • Heap Fetches: 153604
98.          

SubPlan (forIndex Only Scan)

99. 12,251.604 91,887.030 ↑ 1.0 1 6,125,802

Limit (cost=9.05..9.06 rows=1 width=20) (actual time=0.014..0.015 rows=1 loops=6,125,802)

100. 36,754.812 79,635.426 ↑ 2.0 1 6,125,802

Sort (cost=9.05..9.06 rows=2 width=20) (actual time=0.013..0.013 rows=1 loops=6,125,802)

  • Sort Key: empleados_movimientos_5.fecha, empleados_movimientos_5.id
  • Sort Method: quicksort Memory: 25kB
101. 42,880.614 42,880.614 ↑ 1.0 2 6,125,802

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_5 (cost=0.00..9.04 rows=2 width=20) (actual time=0.005..0.007 rows=2 loops=6,125,802)

  • Index Cond: (empleado_id = emplea_1.id)
  • Rows Removed by Index Recheck: 0
102. 83.745 6,314.373 ↑ 1.0 1 5,583

Aggregate (cost=1,759.76..1,759.77 rows=1 width=8) (actual time=1.131..1.131 rows=1 loops=5,583)

103. 122.826 6,230.628 ↑ 3.2 12 5,583

Nested Loop (cost=0.72..1,759.67 rows=38 width=8) (actual time=0.113..1.116 rows=12 loops=5,583)

104. 33.498 33.498 ↑ 1.0 1 5,583

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es_4 (cost=0.29..6.31 rows=1 width=4) (actual time=0.005..0.006 rows=1 loops=5,583)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 39
105. 342.901 6,074.304 ↑ 3.2 12 5,583

Nested Loop (cost=0.43..1,752.98 rows=38 width=16) (actual time=0.103..1.088 rows=12 loops=5,583)

106. 770.724 4,622.724 ↑ 3.2 18 5,583

Index Scan using empleados_npatronal_id_idx on empleados empleados_4 (cost=0.43..1,403.10 rows=58 width=24) (actual time=0.058..0.828 rows=18 loops=5,583)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 14)
  • Rows Removed by Filter: 20
107.          

SubPlan (forIndex Scan)

108. 428.000 3,852.000 ↑ 1.0 1 214,000

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.018..0.018 rows=1 loops=214,000)

109. 1,070.000 3,424.000 ↑ 2.0 1 214,000

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.016..0.016 rows=1 loops=214,000)

  • Sort Key: empleados_movimientos_6.fecha, empleados_movimientos_6.id
  • Sort Method: quicksort Memory: 25kB
110. 1,070.204 2,354.000 ↑ 1.0 2 214,000

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.007..0.011 rows=2 loops=214,000)

  • One-Time Filter: (empleados_4.empresa_id = emp_1.id)
111. 1,283.796 1,283.796 ↑ 1.0 2 213,966

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_6 (cost=0.00..9.04 rows=2 width=20) (actual time=0.004..0.006 rows=2 loops=213,966)

  • Index Cond: (empleado_id = empleados_4.id)
  • Rows Removed by Index Recheck: 0
112. 1,108.679 1,108.679 ↑ 1.0 1 100,789

Index Scan using persons_id_idx on persons persons_2 (cost=0.00..6.02 rows=1 width=8) (actual time=0.010..0.011 rows=1 loops=100,789)

  • Index Cond: (id = empleados_4.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'M'::text)
  • Rows Removed by Filter: 0
113. 55.830 5,476.923 ↑ 1.0 1 5,583

Aggregate (cost=1,759.54..1,759.55 rows=1 width=8) (actual time=0.981..0.981 rows=1 loops=5,583)

114. 78.162 5,421.093 ↑ 3.3 6 5,583

Nested Loop (cost=0.72..1,759.49 rows=20 width=8) (actual time=0.166..0.971 rows=6 loops=5,583)

115. 22.332 22.332 ↑ 1.0 1 5,583

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es_5 (cost=0.29..6.31 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=5,583)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 39
116. 283.258 5,320.599 ↑ 3.3 6 5,583

Nested Loop (cost=0.43..1,752.98 rows=20 width=16) (actual time=0.159..0.953 rows=6 loops=5,583)

117. 681.396 4,533.396 ↑ 3.2 18 5,583

Index Scan using empleados_npatronal_id_idx on empleados empleados_5 (cost=0.43..1,403.10 rows=58 width=24) (actual time=0.054..0.812 rows=18 loops=5,583)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 16)
  • Rows Removed by Filter: 20
118.          

SubPlan (forIndex Scan)

119. 428.000 3,852.000 ↑ 1.0 1 214,000

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.018..0.018 rows=1 loops=214,000)

120. 1,070.000 3,424.000 ↑ 2.0 1 214,000

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.016..0.016 rows=1 loops=214,000)

  • Sort Key: empleados_movimientos_7.fecha, empleados_movimientos_7.id
  • Sort Method: quicksort Memory: 25kB
121. 1,070.204 2,354.000 ↑ 1.0 2 214,000

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.007..0.011 rows=2 loops=214,000)

  • One-Time Filter: (empleados_5.empresa_id = emp_1.id)
122. 1,283.796 1,283.796 ↑ 1.0 2 213,966

Index Scan using empleados_movimientos_empleado_id_idx on empleados_movimientos empleados_movimientos_7 (cost=0.00..9.04 rows=2 width=20) (actual time=0.004..0.006 rows=2 loops=213,966)

  • Index Cond: (empleado_id = empleados_5.id)
  • Rows Removed by Index Recheck: 0
123. 503.945 503.945 ↓ 0.0 0 100,789

Index Scan using persons_id_idx on persons persons_3 (cost=0.00..6.02 rows=1 width=8) (actual time=0.004..0.005 rows=0 loops=100,789)

  • Index Cond: (id = empleados_5.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'F'::text)
  • Rows Removed by Filter: 1
124. 16.749 329.397 ↑ 1.0 1 5,583

Limit (cost=7.19..7.19 rows=1 width=134) (actual time=0.058..0.059 rows=1 loops=5,583)

125. 33.498 312.648 ↑ 1.0 1 5,583

Sort (cost=7.19..7.19 rows=1 width=134) (actual time=0.056..0.056 rows=1 loops=5,583)

  • Sort Key: cambio_situacion_empresa_1.fecha_creacion, cambio_situacion_empresa_1.id_cambio_situacion_empresa
  • Sort Method: quicksort Memory: 25kB
126. 87.022 279.150 ↑ 1.0 1 5,583

Nested Loop (cost=0.00..7.18 rows=1 width=134) (actual time=0.033..0.050 rows=1 loops=5,583)

  • Join Filter: (cambio_situacion_empresa_1.situacion_act = situacion_emp_1.id_situacion)
  • Rows Removed by Join Filter: 8
127. 133.992 133.992 ↑ 1.0 1 5,583

Index Scan using cambio_situacion_empresa_nro_patronal_idx on cambio_situacion_empresa cambio_situacion_empresa_1 (cost=0.00..6.02 rows=1 width=20) (actual time=0.019..0.024 rows=1 loops=5,583)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
128. 58.136 58.136 ↑ 1.0 7 7,267

Seq Scan on situacion_emp situacion_emp_1 (cost=0.00..1.07 rows=7 width=122) (actual time=0.002..0.008 rows=7 loops=7,267)