explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9DD2

Settings
# exclusive inclusive rows x rows loops node
1. 108.813 220,945.932 ↓ 1.1 55,547 1

Unique (cost=311,594,675.76..311,598,344.33 rows=50,601 width=964) (actual time=220,761.620..220,945.932 rows=55,547 loops=1)

2. 2,520.271 220,837.119 ↓ 1.1 55,547 1

Sort (cost=311,594,675.76..311,594,802.26 rows=50,601 width=964) (actual time=220,761.617..220,837.119 rows=55,547 loops=1)

  • Sort Key: emp.document, emp.legal, emp.fantasy, empresas_sucursales.nro_patronal_ips, empresas_categorias.descripcion, empresas_sucursales.direccion, empresas_sucursales.fecha_inscrip, empresas_sucursales.activ_principal, empresas_sucursales.tel, empresas_sucursales.email, city.name, distritos.name, ((SubPlan 11)), ((SubPlan 13)), ((SubPlan 15)), ((SubPlan 17)), ((SubPlan 18)), empresas_types.name, actividad_econ.descripcion, empresas_sucursales_types.name, empresas_sucursales.nro_patronal, empresas_sucursales.id_activ_econ, empresas_sucursales.city_id, empresas_sucursales.distrito_id, empresas_sucursales.geolocation, empresas_sucursales.id_tipo_inscripcion, emp.type, emp.id_categoria_empresa
  • Sort Method: external merge Disk: 22392kB
3. 80.524 218,316.848 ↓ 1.1 55,547 1

Append (cost=0.43..311,572,338.08 rows=50,601 width=964) (actual time=0.578..218,316.848 rows=55,547 loops=1)

4. 653.460 106,344.880 ↑ 1.0 49,965 1

Nested Loop Left Join (cost=0.43..308,173,989.66 rows=50,050 width=964) (actual time=0.576..106,344.880 rows=49,965 loops=1)

  • Join Filter: (empresas_sucursales.type = empresas_sucursales_types.id)
5. 191.510 2,813.485 ↑ 1.0 49,965 1

Nested Loop Left Join (cost=0.43..29,410.98 rows=50,050 width=940) (actual time=0.256..2,813.485 rows=49,965 loops=1)

6. 183.132 2,422.115 ↑ 1.0 49,965 1

Nested Loop Left Join (cost=0.43..27,989.61 rows=50,050 width=886) (actual time=0.207..2,422.115 rows=49,965 loops=1)

7. 163.472 2,039.123 ↑ 1.0 49,965 1

Nested Loop Left Join (cost=0.43..26,598.23 rows=50,050 width=876) (actual time=0.169..2,039.123 rows=49,965 loops=1)

8. 139.768 1,625.826 ↑ 1.0 49,965 1

Nested Loop Left Join (cost=0.43..25,188.86 rows=50,050 width=840) (actual time=0.122..1,625.826 rows=49,965 loops=1)

9. 165.191 1,436.093 ↑ 1.0 49,965 1

Nested Loop Left Join (cost=0.29..16,519.07 rows=50,050 width=324) (actual time=0.118..1,436.093 rows=49,965 loops=1)

10. 216.444 1,071.042 ↑ 1.0 49,965 1

Nested Loop (cost=0.29..15,127.63 rows=50,050 width=311) (actual time=0.083..1,071.042 rows=49,965 loops=1)

11. 205.027 205.027 ↑ 1.0 49,967 1

Index Scan Backward using empresas_sucursales_nro_patronal_key on empresas_sucursales (cost=0.29..7,037.64 rows=50,053 width=237) (actual time=0.039..205.027 rows=49,967 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 5621
12. 649.571 649.571 ↑ 1.0 1 49,967

Index Scan using empresas_id_idx on empresas emp (cost=0.00..0.15 rows=1 width=82) (actual time=0.012..0.013 rows=1 loops=49,967)

  • Index Cond: (id = empresas_sucursales.empresa_id)
  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
  • Rows Removed by Filter: 0
13. 199.860 199.860 ↑ 1.0 1 49,965

Index Scan using empresas_types_id_idx on empresas_types (cost=0.00..0.02 rows=1 width=21) (actual time=0.003..0.004 rows=1 loops=49,965)

  • Index Cond: (emp.type = id)
14. 49.965 49.965 ↓ 0.0 0 49,965

Index Scan using empresas_categorias_pkey on empresas_categorias (cost=0.14..0.16 rows=1 width=520) (actual time=0.001..0.001 rows=0 loops=49,965)

  • Index Cond: (emp.id_categoria_empresa = id_categoria_empresa)
15. 249.825 249.825 ↑ 1.0 1 49,965

Index Scan using city_id_idx on city (cost=0.00..0.02 rows=1 width=40) (actual time=0.004..0.005 rows=1 loops=49,965)

  • Index Cond: (empresas_sucursales.city_id = id)
16. 199.860 199.860 ↑ 1.0 1 49,965

Index Scan using distritos_id_idx on distritos (cost=0.00..0.02 rows=1 width=18) (actual time=0.003..0.004 rows=1 loops=49,965)

  • Index Cond: (empresas_sucursales.distrito_id = id)
17. 199.860 199.860 ↑ 1.0 1 49,965

Index Scan using actividad_econ_id_activ_econ_idx on actividad_econ (cost=0.00..0.02 rows=1 width=58) (actual time=0.003..0.004 rows=1 loops=49,965)

  • Index Cond: (empresas_sucursales.id_activ_econ = id_activ_econ)
18. 99.915 99.930 ↑ 1.0 1 49,965

Materialize (cost=0.00..1.04 rows=1 width=40) (actual time=0.001..0.002 rows=1 loops=49,965)

19. 0.015 0.015 ↑ 1.0 1 1

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

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

SubPlan (forNested Loop Left Join)

21. 549.615 27,680.610 ↑ 1.0 1 49,965

Aggregate (cost=1,393.61..1,393.62 rows=1 width=8) (actual time=0.554..0.554 rows=1 loops=49,965)

22. 999.300 27,130.995 ↑ 5.8 10 49,965

Nested Loop (cost=4.17..1,393.46 rows=58 width=8) (actual time=0.072..0.543 rows=10 loops=49,965)

23. 199.860 199.860 ↑ 1.0 1 49,965

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

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 38
24. 3,211.930 25,931.835 ↑ 5.8 10 49,965

Bitmap Heap Scan on empleados empleados_3 (cost=3.88..1,389.58 rows=58 width=24) (actual time=0.064..0.519 rows=10 loops=49,965)

  • Recheck Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 10)
  • Rows Removed by Filter: 12
25. 649.545 649.545 ↑ 5.3 22 49,965

Bitmap Index Scan on empleados_npatronal_idx (cost=0.00..3.87 rows=116 width=0) (actual time=0.013..0.013 rows=22 loops=49,965)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
26.          

SubPlan (forBitmap Heap Scan)

27. 3,310.554 22,070.360 ↑ 1.0 1 1,103,518

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

28. 4,414.072 18,759.806 ↑ 2.0 1 1,103,518

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

  • Sort Key: empleados_movimientos_4.fecha, empleados_movimientos_4.id
  • Sort Method: quicksort Memory: 25kB
29. 5,519.686 14,345.734 ↑ 1.0 2 1,103,518

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.008..0.013 rows=2 loops=1,103,518)

  • One-Time Filter: (empleados_3.empresa_id = emp.id)
30. 8,826.048 8,826.048 ↑ 1.0 2 1,103,256

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=1,103,256)

  • Index Cond: (empleado_id = empleados_3.id)
  • Rows Removed by Index Recheck: 0
31. 749.475 20,785.440 ↑ 1.0 1 49,965

Aggregate (cost=1,269.60..1,269.63 rows=1 width=16) (actual time=0.415..0.416 rows=1 loops=49,965)

32. 3,759.381 20,035.965 ↑ 5.8 12 49,965

Index Only Scan using empleados_empresa_id_id_idx on empleados emplea_1 (cost=0.43..1,268.20 rows=70 width=16) (actual time=0.034..0.401 rows=12 loops=49,965)

  • Index Cond: (empresa_id = emp.id)
  • Filter: (SubPlan 12)
  • Rows Removed by Filter: 15
  • Heap Fetches: 16605
33.          

SubPlan (forIndex Only Scan)

34. 2,712.764 16,276.584 ↑ 1.0 1 1,356,382

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

35. 6,781.910 13,563.820 ↑ 2.0 1 1,356,382

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

  • Sort Key: empleados_movimientos_5.fecha, empleados_movimientos_5.id
  • Sort Method: quicksort Memory: 25kB
36. 6,781.910 6,781.910 ↑ 1.0 2 1,356,382

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

  • Index Cond: (empleado_id = emplea_1.id)
  • Rows Removed by Index Recheck: 0
37. 399.720 27,230.925 ↑ 1.0 1 49,965

Aggregate (cost=1,743.24..1,743.25 rows=1 width=8) (actual time=0.544..0.545 rows=1 loops=49,965)

38. 649.545 26,831.205 ↑ 6.3 6 49,965

Nested Loop (cost=4.17..1,743.15 rows=38 width=8) (actual time=0.073..0.537 rows=6 loops=49,965)

39. 199.860 199.860 ↑ 1.0 1 49,965

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

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 38
40. 1,930.536 25,981.800 ↑ 6.3 6 49,965

Nested Loop (cost=3.88..1,739.46 rows=38 width=16) (actual time=0.067..0.520 rows=6 loops=49,965)

41. 3,179.117 21,085.230 ↑ 5.8 10 49,965

Bitmap Heap Scan on empleados empleados_4 (cost=3.88..1,389.58 rows=58 width=24) (actual time=0.044..0.422 rows=10 loops=49,965)

  • Recheck Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 14)
  • Rows Removed by Filter: 12
42. 249.825 249.825 ↑ 5.3 22 49,965

Bitmap Index Scan on empleados_npatronal_idx (cost=0.00..3.87 rows=116 width=0) (actual time=0.005..0.005 rows=22 loops=49,965)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
43.          

SubPlan (forBitmap Heap Scan)

44. 2,207.036 17,656.288 ↑ 1.0 1 1,103,518

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

45. 4,414.072 15,449.252 ↑ 2.0 1 1,103,518

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

  • Sort Key: empleados_movimientos_6.fecha, empleados_movimientos_6.id
  • Sort Method: quicksort Memory: 25kB
46. 5,518.900 11,035.180 ↑ 1.0 2 1,103,518

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.005..0.010 rows=2 loops=1,103,518)

  • One-Time Filter: (empleados_4.empresa_id = emp.id)
47. 5,516.280 5,516.280 ↑ 1.0 2 1,103,256

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

  • Index Cond: (empleado_id = empleados_4.id)
  • Rows Removed by Index Recheck: 0
48. 2,966.034 2,966.034 ↑ 1.0 1 494,339

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

  • Index Cond: (id = empleados_4.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'M'::text)
  • Rows Removed by Filter: 0
49. 299.790 25,282.290 ↑ 1.0 1 49,965

Aggregate (cost=1,743.02..1,743.03 rows=1 width=8) (actual time=0.505..0.506 rows=1 loops=49,965)

50. 399.720 24,982.500 ↑ 6.7 3 49,965

Nested Loop (cost=4.17..1,742.97 rows=20 width=8) (actual time=0.109..0.500 rows=3 loops=49,965)

51. 199.860 199.860 ↑ 1.0 1 49,965

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

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 38
52. 1,320.334 24,382.920 ↑ 6.7 3 49,965

Nested Loop (cost=3.88..1,739.46 rows=20 width=16) (actual time=0.103..0.488 rows=3 loops=49,965)

53. 3,179.117 21,085.230 ↑ 5.8 10 49,965

Bitmap Heap Scan on empleados empleados_5 (cost=3.88..1,389.58 rows=58 width=24) (actual time=0.044..0.422 rows=10 loops=49,965)

  • Recheck Cond: (npatronal = empresas_sucursales.nro_patronal)
  • Filter: (SubPlan 16)
  • Rows Removed by Filter: 12
54. 249.825 249.825 ↑ 5.3 22 49,965

Bitmap Index Scan on empleados_npatronal_idx (cost=0.00..3.87 rows=116 width=0) (actual time=0.005..0.005 rows=22 loops=49,965)

  • Index Cond: (npatronal = empresas_sucursales.nro_patronal)
55.          

SubPlan (forBitmap Heap Scan)

56. 2,207.036 17,656.288 ↑ 1.0 1 1,103,518

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

57. 4,414.072 15,449.252 ↑ 2.0 1 1,103,518

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

  • Sort Key: empleados_movimientos_7.fecha, empleados_movimientos_7.id
  • Sort Method: quicksort Memory: 25kB
58. 5,518.900 11,035.180 ↑ 1.0 2 1,103,518

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.005..0.010 rows=2 loops=1,103,518)

  • One-Time Filter: (empleados_5.empresa_id = emp.id)
59. 5,516.280 5,516.280 ↑ 1.0 2 1,103,256

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=1,103,256)

  • Index Cond: (empleado_id = empleados_5.id)
  • Rows Removed by Index Recheck: 0
60. 1,977.356 1,977.356 ↓ 0.0 0 494,339

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

  • Index Cond: (id = empleados_5.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'F'::text)
  • Rows Removed by Filter: 1
61. 149.895 1,798.740 ↑ 1.0 1 49,965

Limit (cost=7.19..7.19 rows=1 width=134) (actual time=0.035..0.036 rows=1 loops=49,965)

62. 199.860 1,648.845 ↑ 1.0 1 49,965

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

  • Sort Key: cambio_situacion_empresa_1.fecha_creacion, cambio_situacion_empresa_1.id_cambio_situacion_empresa
  • Sort Method: top-N heapsort Memory: 25kB
63. 617.786 1,448.985 ↑ 1.0 1 49,965

Nested Loop (cost=0.00..7.18 rows=1 width=134) (actual time=0.017..0.029 rows=1 loops=49,965)

  • Join Filter: (cambio_situacion_empresa_1.situacion_act = situacion_emp_1.id_situacion)
  • Rows Removed by Join Filter: 7
64. 449.685 449.685 ↑ 1.0 1 49,965

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.007..0.009 rows=1 loops=49,965)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
65. 381.514 381.514 ↑ 1.0 7 54,502

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

66. 26.317 111,891.444 ↓ 10.1 5,582 1

Sort (cost=3,397,841.03..3,397,842.41 rows=551 width=966) (actual time=111,886.753..111,891.444 rows=5,582 loops=1)

  • Sort Key: empresas_sucursales_1.nro_patronal
  • Sort Method: quicksort Memory: 3804kB
67. 95.548 111,865.127 ↓ 10.1 5,582 1

Nested Loop Left Join (cost=13.15..3,397,815.95 rows=551 width=966) (actual time=1.447..111,865.127 rows=5,582 loops=1)

  • Join Filter: (empresas_sucursales_1.type = empresas_sucursales_types_1.id)
  • Rows Removed by Join Filter: 11164
68. 20.872 308.203 ↓ 10.1 5,582 1

Nested Loop Left Join (cost=13.15..5,437.49 rows=551 width=942) (actual time=0.090..308.203 rows=5,582 loops=1)

69. 24.398 259.421 ↓ 10.1 5,582 1

Nested Loop Left Join (cost=13.15..5,377.34 rows=551 width=888) (actual time=0.082..259.421 rows=5,582 loops=1)

70. 24.369 212.695 ↓ 10.1 5,582 1

Nested Loop Left Join (cost=13.15..5,347.19 rows=551 width=878) (actual time=0.073..212.695 rows=5,582 loops=1)

71. 12.031 160.416 ↓ 10.1 5,582 1

Hash Left Join (cost=13.15..5,299.04 rows=551 width=842) (actual time=0.062..160.416 rows=5,582 loops=1)

  • Hash Cond: (emp_1.id_categoria_empresa = empresas_categorias_1.id_categoria_empresa)
72. 21.197 148.372 ↓ 10.1 5,582 1

Nested Loop Left Join (cost=0.00..5,283.77 rows=551 width=326) (actual time=0.039..148.372 rows=5,582 loops=1)

73. 22.495 104.847 ↓ 10.1 5,582 1

Nested Loop (cost=0.00..5,268.45 rows=551 width=313) (actual time=0.030..104.847 rows=5,582 loops=1)

74. 26.142 26.142 ↓ 10.2 5,621 1

Seq Scan on empresas_sucursales empresas_sucursales_1 (cost=0.00..2,751.79 rows=551 width=301) (actual time=0.013..26.142 rows=5,621 loops=1)

  • Filter: ((type <> 1) AND (type <> 1))
  • Rows Removed by Filter: 49967
75. 56.210 56.210 ↑ 1.0 1 5,621

Index Scan using empresas_id_idx on empresas emp_1 (cost=0.00..4.56 rows=1 width=20) (actual time=0.009..0.010 rows=1 loops=5,621)

  • 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. 22.328 22.328 ↑ 1.0 1 5,582

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.003..0.004 rows=1 loops=5,582)

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

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

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

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

79. 27.910 27.910 ↑ 1.0 1 5,582

Index Scan using city_id_idx on city city_1 (cost=0.00..0.08 rows=1 width=40) (actual time=0.004..0.005 rows=1 loops=5,582)

  • Index Cond: (empresas_sucursales_1.city_id = id)
80. 22.328 22.328 ↑ 1.0 1 5,582

Index Scan using distritos_id_idx on distritos distritos_1 (cost=0.00..0.04 rows=1 width=18) (actual time=0.003..0.004 rows=1 loops=5,582)

  • Index Cond: (empresas_sucursales_1.distrito_id = id)
81. 27.910 27.910 ↑ 1.0 1 5,582

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.004..0.005 rows=1 loops=5,582)

  • Index Cond: (empresas_sucursales_1.id_activ_econ = id_activ_econ)
82. 16.733 16.746 ↑ 1.0 3 5,582

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

83. 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)

84.          

SubPlan (forNested Loop Left Join)

85. 100.476 5,062.874 ↑ 1.0 1 5,582

Aggregate (cost=1,393.61..1,393.62 rows=1 width=8) (actual time=0.907..0.907 rows=1 loops=5,582)

86. 178.624 4,962.398 ↑ 3.2 18 5,582

Nested Loop (cost=4.17..1,393.46 rows=58 width=8) (actual time=0.084..0.889 rows=18 loops=5,582)

87. 33.492 33.492 ↑ 1.0 1 5,582

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

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 3
88. 804.000 4,750.282 ↑ 3.2 18 5,582

Bitmap Heap Scan on empleados (cost=3.88..1,389.58 rows=58 width=24) (actual time=0.074..0.851 rows=18 loops=5,582)

  • Recheck Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 1)
  • Rows Removed by Filter: 20
89. 94.894 94.894 ↑ 3.1 38 5,582

Bitmap Index Scan on empleados_npatronal_idx (cost=0.00..3.87 rows=116 width=0) (actual time=0.017..0.017 rows=38 loops=5,582)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
90.          

SubPlan (forBitmap Heap Scan)

91. 427.932 3,851.388 ↑ 1.0 1 213,966

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

92. 1,069.830 3,423.456 ↑ 2.0 1 213,966

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

  • Sort Key: empleados_movimientos.fecha, empleados_movimientos.id
  • Sort Method: quicksort Memory: 25kB
93. 1,070.034 2,353.626 ↑ 1.0 2 213,966

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

  • One-Time Filter: (empleados.empresa_id = emp_1.id)
94. 1,283.592 1,283.592 ↑ 1.0 2 213,932

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

  • Index Cond: (empleado_id = empleados.id)
  • Rows Removed by Index Recheck: 0
95. 2,294.202 95,748.046 ↑ 1.0 1 5,582

Aggregate (cost=1,269.60..1,269.63 rows=1 width=16) (actual time=17.153..17.153 rows=1 loops=5,582)

96. 13,826.790 93,453.844 ↓ 6.8 475 5,582

Index Only Scan using empleados_empresa_id_id_idx on empleados emplea (cost=0.43..1,268.20 rows=70 width=16) (actual time=0.078..16.742 rows=475 loops=5,582)

  • Index Cond: (empresa_id = emp_1.id)
  • Filter: (SubPlan 3)
  • Rows Removed by Filter: 623
  • Heap Fetches: 99518
97.          

SubPlan (forIndex Only Scan)

98. 12,250.316 79,627.054 ↑ 1.0 1 6,125,158

Limit (cost=9.05..9.06 rows=1 width=20) (actual time=0.013..0.013 rows=1 loops=6,125,158)

99. 30,625.790 67,376.738 ↑ 2.0 1 6,125,158

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

  • Sort Key: empleados_movimientos_1.fecha, empleados_movimientos_1.id
  • Sort Method: quicksort Memory: 25kB
100. 36,750.948 36,750.948 ↑ 1.0 2 6,125,158

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.006 rows=2 loops=6,125,158)

  • Index Cond: (empleado_id = emplea.id)
  • Rows Removed by Index Recheck: 0
101. 72.566 5,598.746 ↑ 1.0 1 5,582

Aggregate (cost=1,743.24..1,743.25 rows=1 width=8) (actual time=1.002..1.003 rows=1 loops=5,582)

102. 117.222 5,526.180 ↑ 3.2 12 5,582

Nested Loop (cost=4.17..1,743.15 rows=38 width=8) (actual time=0.109..0.990 rows=12 loops=5,582)

103. 27.910 27.910 ↑ 1.0 1 5,582

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es_1 (cost=0.29..3.31 rows=1 width=4) (actual time=0.004..0.005 rows=1 loops=5,582)

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 3
104. 287.492 5,381.048 ↑ 3.2 12 5,582

Nested Loop (cost=3.88..1,739.46 rows=38 width=16) (actual time=0.101..0.964 rows=12 loops=5,582)

105. 498.840 4,186.500 ↑ 3.2 18 5,582

Bitmap Heap Scan on empleados empleados_1 (cost=3.88..1,389.58 rows=58 width=24) (actual time=0.056..0.750 rows=18 loops=5,582)

  • Recheck Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 5)
  • Rows Removed by Filter: 20
106. 50.238 50.238 ↑ 3.1 38 5,582

Bitmap Index Scan on empleados_npatronal_idx (cost=0.00..3.87 rows=116 width=0) (actual time=0.009..0.009 rows=38 loops=5,582)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
107.          

SubPlan (forBitmap Heap Scan)

108. 641.898 3,637.422 ↑ 1.0 1 213,966

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.016..0.017 rows=1 loops=213,966)

109. 855.864 2,995.524 ↑ 2.0 1 213,966

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.014..0.014 rows=1 loops=213,966)

  • Sort Key: empleados_movimientos_2.fecha, empleados_movimientos_2.id
  • Sort Method: quicksort Memory: 25kB
110. 1,070.000 2,139.660 ↑ 1.0 2 213,966

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.005..0.010 rows=2 loops=213,966)

  • One-Time Filter: (empleados_1.empresa_id = emp_1.id)
111. 1,069.660 1,069.660 ↑ 1.0 2 213,932

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=213,932)

  • Index Cond: (empleado_id = empleados_1.id)
  • Rows Removed by Index Recheck: 0
112. 907.056 907.056 ↑ 1.0 1 100,784

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

  • Index Cond: (id = empleados_1.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'M'::text)
  • Rows Removed by Filter: 0
113. 50.238 4,800.520 ↑ 1.0 1 5,582

Aggregate (cost=1,743.02..1,743.03 rows=1 width=8) (actual time=0.859..0.860 rows=1 loops=5,582)

114. 72.566 4,750.282 ↑ 3.3 6 5,582

Nested Loop (cost=4.17..1,742.97 rows=20 width=8) (actual time=0.146..0.851 rows=6 loops=5,582)

115. 22.328 22.328 ↑ 1.0 1 5,582

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

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
  • Heap Fetches: 3
116. 333.996 4,655.388 ↑ 3.3 6 5,582

Nested Loop (cost=3.88..1,739.46 rows=20 width=16) (actual time=0.139..0.834 rows=6 loops=5,582)

117. 556.510 4,019.040 ↑ 3.2 18 5,582

Bitmap Heap Scan on empleados empleados_2 (cost=3.88..1,389.58 rows=58 width=24) (actual time=0.053..0.720 rows=18 loops=5,582)

  • Recheck Cond: (npatronal = empresas_sucursales_1.nro_patronal)
  • Filter: (SubPlan 7)
  • Rows Removed by Filter: 20
118. 39.074 39.074 ↑ 3.1 38 5,582

Bitmap Index Scan on empleados_npatronal_idx (cost=0.00..3.87 rows=116 width=0) (actual time=0.007..0.007 rows=38 loops=5,582)

  • Index Cond: (npatronal = empresas_sucursales_1.nro_patronal)
119.          

SubPlan (forBitmap Heap Scan)

120. 427.932 3,423.456 ↑ 1.0 1 213,966

Limit (cost=9.06..9.06 rows=1 width=20) (actual time=0.016..0.016 rows=1 loops=213,966)

121. 1,069.830 2,995.524 ↑ 2.0 1 213,966

Sort (cost=9.06..9.06 rows=2 width=20) (actual time=0.014..0.014 rows=1 loops=213,966)

  • Sort Key: empleados_movimientos_3.fecha, empleados_movimientos_3.id
  • Sort Method: quicksort Memory: 25kB
122. 856.034 1,925.694 ↑ 1.0 2 213,966

Result (cost=0.00..9.05 rows=2 width=20) (actual time=0.005..0.009 rows=2 loops=213,966)

  • One-Time Filter: (empleados_2.empresa_id = emp_1.id)
123. 1,069.660 1,069.660 ↑ 1.0 2 213,932

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=213,932)

  • Index Cond: (empleado_id = empleados_2.id)
  • Rows Removed by Index Recheck: 0
124. 302.352 302.352 ↓ 0.0 0 100,784

Index Scan using persons_id_idx on persons persons_1 (cost=0.00..6.02 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=100,784)

  • Index Cond: (id = empleados_2.persona_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((sexo)::text = 'F'::text)
  • Rows Removed by Filter: 1
125. 16.746 234.444 ↑ 1.0 1 5,582

Limit (cost=7.19..7.19 rows=1 width=134) (actual time=0.041..0.042 rows=1 loops=5,582)

126. 27.910 217.698 ↑ 1.0 1 5,582

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

  • Sort Key: cambio_situacion_empresa.fecha_creacion, cambio_situacion_empresa.id_cambio_situacion_empresa
  • Sort Method: quicksort Memory: 25kB
127. 83.169 189.788 ↑ 1.0 1 5,582

Nested Loop (cost=0.00..7.18 rows=1 width=134) (actual time=0.020..0.034 rows=1 loops=5,582)

  • Join Filter: (cambio_situacion_empresa.situacion_act = situacion_emp.id_situacion)
  • Rows Removed by Join Filter: 8
128. 55.820 55.820 ↑ 1.0 1 5,582

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

  • Index Cond: (nro_patronal = empresas_sucursales_1.nro_patronal)
129. 50.799 50.799 ↑ 1.0 7 7,257

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