explain.depesz.com

PostgreSQL's explain analyze made readable

Result: r6iS

Settings
# exclusive inclusive rows x rows loops node
1. 82.383 233,586.795 ↓ 1.1 55,557 1

Append (cost=3,088.70..313,751,891.33 rows=50,527 width=1,130) (actual time=131.663..233,586.795 rows=55,557 loops=1)

2. 676.274 112,618.350 ↓ 1.0 49,973 1

Hash Left Join (cost=3,088.70..310,194,565.02 rows=49,955 width=964) (actual time=131.661..112,618.350 rows=49,973 loops=1)

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

Hash Left Join (cost=3,087.65..9,556.02 rows=49,955 width=940) (actual time=131.221..902.036 rows=49,973 loops=1)

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

Hash Left Join (cost=3,062.90..8,844.40 rows=49,955 width=886) (actual time=129.704..795.465 rows=49,973 loops=1)

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

Hash Left Join (cost=3,061.43..8,156.43 rows=49,955 width=876) (actual time=129.650..698.367 rows=49,973 loops=1)

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

Hash Left Join (cost=3,048.78..7,459.41 rows=49,955 width=840) (actual time=129.136..597.807 rows=49,973 loops=1)

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

Hash Left Join (cost=3,035.63..7,254.03 rows=49,955 width=324) (actual time=129.085..513.546 rows=49,973 loops=1)

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

Hash Join (cost=3,034.04..6,646.14 rows=49,955 width=311) (actual time=128.986..418.706 rows=49,973 loops=1)

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

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

  • Filter: (type = 1)
  • Rows Removed by Filter: 5623
10. 60.773 128.922 ↓ 1.0 49,834 1

Hash (cost=2,411.13..2,411.13 rows=49,833 width=82) (actual time=128.922..128.922 rows=49,834 loops=1)

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

Seq Scan on empresas emp (cost=0.00..2,411.13 rows=49,833 width=82) (actual time=0.009..68.149 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.035 0.071 ↓ 1.2 30 1

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

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

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

14. 0.007 0.037 ↑ 35.0 4 1

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

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

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

16. 0.259 0.500 ↑ 1.0 251 1

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

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

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

18. 0.020 0.043 ↑ 1.2 18 1

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

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

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

20. 0.787 1.502 ↑ 1.0 700 1

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

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

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

22. 0.003 0.034 ↑ 1.0 1 1

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

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

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

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

SubPlan (forHash Left Join)

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

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

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

Nested Loop (cost=0.72..1,409.98 rows=58 width=8) (actual time=0.068..0.600 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.004..0.005 rows=1 loops=49,973)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 68
28. 4,454.549 28,734.475 ↑ 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.060..0.575 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.266 24,279.926 ↑ 1.0 1 1,103,633

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

31. 5,518.165 22,072.660 ↑ 2.0 1 1,103,633

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

  • Sort Key: empleados_movimientos.fecha, empleados_movimientos.id
  • Sort Method: quicksort Memory: 25kB
32. 6,624.156 16,554.495 ↑ 1.0 2 1,103,633

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

  • One-Time Filter: (empleados.empresa_id = emp.id)
33. 9,930.339 9,930.339 ↑ 1.0 2 1,103,371

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

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

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

35. 3,346.483 22,337.931 ↑ 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.038..0.447 rows=12 loops=49,973)

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

SubPlan (forIndex Only Scan)

37. 2,713.064 18,991.448 ↑ 1.0 1 1,356,532

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

38. 6,782.660 16,278.384 ↑ 2.0 1 1,356,532

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

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

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.004..0.007 rows=2 loops=1,356,532)

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

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

41. 649.649 28,184.772 ↑ 6.3 6 49,973

Nested Loop (cost=0.72..1,759.67 rows=38 width=8) (actual time=0.068..0.564 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: 68
43. 1,931.728 27,335.231 ↑ 6.3 6 49,973

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

44. 3,676.116 22,437.877 ↑ 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.449 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.266 18,761.761 ↑ 1.0 1 1,103,633

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

47. 4,414.532 16,554.495 ↑ 2.0 1 1,103,633

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

  • Sort Key: empleados_movimientos_2.fecha, empleados_movimientos_2.id
  • Sort Method: quicksort Memory: 25kB
48. 6,623.108 12,139.963 ↑ 1.0 2 1,103,633

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

  • One-Time Filter: (empleados_1.empresa_id = emp.id)
49. 5,516.855 5,516.855 ↑ 1.0 2 1,103,371

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.003..0.005 rows=2 loops=1,103,371)

  • Index Cond: (empleado_id = empleados_1.id)
  • Rows Removed by Index Recheck: 0
50. 2,965.626 2,965.626 ↑ 1.0 1 494,271

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

  • 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 26,835.501 ↑ 1.0 1 49,973

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

52. 399.784 26,535.663 ↑ 6.7 3 49,973

Nested Loop (cost=0.72..1,759.49 rows=20 width=8) (actual time=0.105..0.531 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: 68
54. 1,670.945 25,935.987 ↑ 6.7 3 49,973

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

55. 3,526.197 22,287.958 ↑ 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.039..0.446 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.266 18,761.761 ↑ 1.0 1 1,103,633

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

58. 4,414.532 16,554.495 ↑ 2.0 1 1,103,633

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

  • Sort Key: empleados_movimientos_3.fecha, empleados_movimientos_3.id
  • Sort Method: quicksort Memory: 25kB
59. 6,623.108 12,139.963 ↑ 1.0 2 1,103,633

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

  • One-Time Filter: (empleados_2.empresa_id = emp.id)
60. 5,516.855 5,516.855 ↑ 1.0 2 1,103,371

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.003..0.005 rows=2 loops=1,103,371)

  • Index Cond: (empleado_id = empleados_2.id)
  • Rows Removed by Index Recheck: 0
61. 1,977.084 1,977.084 ↓ 0.0 0 494,271

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

  • 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 1,948.947 ↑ 1.0 1 49,973

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

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

Sort (cost=7.19..7.19 rows=1 width=134) (actual time=0.037..0.037 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.344 1,599.136 ↑ 1.0 1 49,973

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

  • Join Filter: (cambio_situacion_empresa.situacion_act = situacion_emp.id_situacion)
  • Rows Removed by Join Filter: 7
65. 599.676 599.676 ↑ 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.009..0.012 rows=1 loops=49,973)

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

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

67. 105.200 120,886.062 ↓ 9.8 5,584 1

Nested Loop Left Join (cost=27.56..3,556,821.04 rows=572 width=966) (actual time=2.051..120,886.062 rows=5,584 loops=1)

  • Join Filter: (empresas_sucursales_1.type = empresas_sucursales_types_1.id)
  • Rows Removed by Join Filter: 11168
68. 22.479 384.238 ↓ 9.8 5,584 1

Nested Loop Left Join (cost=27.56..5,089.09 rows=572 width=942) (actual time=0.700..384.238 rows=5,584 loops=1)

69. 16.671 322.671 ↓ 9.8 5,584 1

Hash Left Join (cost=27.56..5,028.36 rows=572 width=888) (actual time=0.662..322.671 rows=5,584 loops=1)

  • Hash Cond: (empresas_sucursales_1.distrito_id = distritos_1.id)
70. 14.919 305.957 ↓ 9.8 5,584 1

Hash Left Join (cost=26.09..5,019.02 rows=572 width=878) (actual time=0.606..305.957 rows=5,584 loops=1)

  • Hash Cond: (empresas_sucursales_1.city_id = city_1.id)
71. 11.729 290.581 ↓ 9.8 5,584 1

Hash Left Join (cost=13.44..4,998.54 rows=572 width=842) (actual time=0.137..290.581 rows=5,584 loops=1)

  • Hash Cond: (emp_1.id_categoria_empresa = empresas_categorias_1.id_categoria_empresa)
72. 28.997 278.829 ↓ 9.8 5,584 1

Nested Loop Left Join (cost=0.29..4,983.19 rows=572 width=326) (actual time=0.101..278.829 rows=5,584 loops=1)

73. 23.427 216.328 ↓ 9.8 5,584 1

Nested Loop (cost=0.29..4,967.29 rows=572 width=313) (actual time=0.067..216.328 rows=5,584 loops=1)

74. 108.556 108.556 ↓ 9.8 5,623 1

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

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

Index Scan using empresas_id_document_id_categoria_empresa_idx on empresas emp_1 (cost=0.29..3.86 rows=1 width=20) (actual time=0.014..0.015 rows=1 loops=5,623)

  • 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.504 33.504 ↑ 1.0 1 5,584

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.005..0.006 rows=1 loops=5,584)

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

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

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

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

79. 0.218 0.457 ↑ 1.0 251 1

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

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

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

81. 0.017 0.043 ↑ 1.2 18 1

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

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

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

83. 39.088 39.088 ↑ 1.0 1 5,584

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,584)

  • Index Cond: (empresas_sucursales_1.id_activ_econ = id_activ_econ)
84. 22.323 22.336 ↑ 1.0 3 5,584

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

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.011..0.013 rows=3 loops=1)

86.          

SubPlan (forNested Loop Left Join)

87. 111.680 5,528.160 ↑ 1.0 1 5,584

Aggregate (cost=1,410.13..1,410.14 rows=1 width=8) (actual time=0.989..0.990 rows=1 loops=5,584)

88. 178.688 5,416.480 ↑ 3.2 18 5,584

Nested Loop (cost=0.72..1,409.98 rows=58 width=8) (actual time=0.081..0.970 rows=18 loops=5,584)

89. 33.504 33.504 ↑ 1.0 1 5,584

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.005..0.006 rows=1 loops=5,584)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 54
90. 924.228 5,204.288 ↑ 3.2 18 5,584

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.932 rows=18 loops=5,584)

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

SubPlan (forIndex Scan)

92. 642.009 4,280.060 ↑ 1.0 1 214,003

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

93. 856.012 3,638.051 ↑ 2.0 1 214,003

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

  • Sort Key: empleados_movimientos_4.fecha, empleados_movimientos_4.id
  • Sort Method: quicksort Memory: 25kB
94. 1,070.287 2,782.039 ↑ 1.0 2 214,003

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

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

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.005..0.008 rows=2 loops=213,969)

  • Index Cond: (empleado_id = empleados_3.id)
  • Rows Removed by Index Recheck: 0
96. 2,362.032 103,583.200 ↑ 1.0 1 5,584

Aggregate (cost=1,272.59..1,272.62 rows=1 width=16) (actual time=18.549..18.550 rows=1 loops=5,584)

97. 15,445.268 101,221.168 ↓ 6.8 475 5,584

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.089..18.127 rows=475 loops=5,584)

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

SubPlan (forIndex Only Scan)

99. 12,253.700 85,775.900 ↑ 1.0 1 6,126,850

Limit (cost=9.05..9.06 rows=1 width=20) (actual time=0.014..0.014 rows=1 loops=6,126,850)

100. 30,634.250 73,522.200 ↑ 2.0 1 6,126,850

Sort (cost=9.05..9.06 rows=2 width=20) (actual time=0.012..0.012 rows=1 loops=6,126,850)

  • Sort Key: empleados_movimientos_5.fecha, empleados_movimientos_5.id
  • Sort Method: quicksort Memory: 25kB
101. 42,887.950 42,887.950 ↑ 1.0 2 6,126,850

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,126,850)

  • Index Cond: (empleado_id = emplea_1.id)
  • Rows Removed by Index Recheck: 0
102. 78.176 5,846.448 ↑ 1.0 1 5,584

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

103. 122.848 5,768.272 ↑ 3.2 12 5,584

Nested Loop (cost=0.72..1,759.67 rows=38 width=8) (actual time=0.104..1.033 rows=12 loops=5,584)

104. 33.504 33.504 ↑ 1.0 1 5,584

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,584)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 54
105. 383.104 5,611.920 ↑ 3.2 12 5,584

Nested Loop (cost=0.43..1,752.98 rows=38 width=16) (actual time=0.095..1.005 rows=12 loops=5,584)

106. 570.474 4,422.528 ↑ 3.2 18 5,584

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

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

SubPlan (forIndex Scan)

108. 428.006 3,852.054 ↑ 1.0 1 214,003

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

109. 1,070.015 3,424.048 ↑ 2.0 1 214,003

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

  • Sort Key: empleados_movimientos_6.fecha, empleados_movimientos_6.id
  • Sort Method: quicksort Memory: 25kB
110. 1,070.219 2,354.033 ↑ 1.0 2 214,003

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

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

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,969)

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

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

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

Aggregate (cost=1,759.54..1,759.55 rows=1 width=8) (actual time=0.915..0.916 rows=1 loops=5,584)

114. 78.176 5,064.688 ↑ 3.3 6 5,584

Nested Loop (cost=0.72..1,759.49 rows=20 width=8) (actual time=0.159..0.907 rows=6 loops=5,584)

115. 22.336 22.336 ↑ 1.0 1 5,584

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,584)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 54
116. 322.776 4,964.176 ↑ 3.3 6 5,584

Nested Loop (cost=0.43..1,752.98 rows=20 width=16) (actual time=0.152..0.889 rows=6 loops=5,584)

117. 600.205 4,238.256 ↑ 3.2 18 5,584

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

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

SubPlan (forIndex Scan)

119. 428.006 3,638.051 ↑ 1.0 1 214,003

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

120. 1,070.015 3,210.045 ↑ 2.0 1 214,003

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

  • Sort Key: empleados_movimientos_7.fecha, empleados_movimientos_7.id
  • Sort Method: quicksort Memory: 25kB
121. 1,070.185 2,140.030 ↑ 1.0 2 214,003

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.006..0.010 rows=2 loops=214,003)

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

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.003..0.005 rows=2 loops=213,969)

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

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

  • 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.752 301.536 ↑ 1.0 1 5,584

Limit (cost=7.19..7.19 rows=1 width=134) (actual time=0.053..0.054 rows=1 loops=5,584)

125. 27.920 284.784 ↑ 1.0 1 5,584

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

  • Sort Key: cambio_situacion_empresa_1.fecha_creacion, cambio_situacion_empresa_1.id_cambio_situacion_empresa
  • Sort Method: quicksort Memory: 25kB
126. 87.040 256.864 ↑ 1.0 1 5,584

Nested Loop (cost=0.00..7.18 rows=1 width=134) (actual time=0.030..0.046 rows=1 loops=5,584)

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

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.016..0.020 rows=1 loops=5,584)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
128. 58.144 58.144 ↑ 1.0 7 7,268

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,268)