explain.depesz.com

PostgreSQL's explain analyze made readable

Result: i9U

Settings
# exclusive inclusive rows x rows loops node
1. 1.860 416.259 ↑ 1.0 1,000 1

Limit (cost=0.58..1,978,224.63 rows=1,000 width=12) (actual time=0.130..416.259 rows=1,000 loops=1)

2. 11.563 414.399 ↑ 52.4 1,000 1

Nested Loop (cost=0.58..103,692,570.80 rows=52,417 width=12) (actual time=0.130..414.399 rows=1,000 loops=1)

3. 18.836 18.836 ↑ 52.4 1,000 1

Index Scan Backward using empresas_sucursales_nro_patronal_key on empresas_sucursales (cost=0.29..5,658.86 rows=52,420 width=44) (actual time=0.023..18.836 rows=1,000 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 149
4. 28.000 28.000 ↑ 1.0 1 1,000

Index Scan using empresas_pk on empresas emp (cost=0.29..0.38 rows=1 width=20) (actual time=0.026..0.028 rows=1 loops=1,000)

  • Index Cond: (id = empresas_sucursales.empresa_id)
  • Filter: (((document)::text <> '0'::text) AND ((document)::text <> ''::text) AND ((document)::text <> '-'::text))
5.          

SubPlan (forNested Loop)

6. 6.000 356.000 ↑ 1.0 1 1,000

Aggregate (cost=1,977.71..1,977.72 rows=1 width=8) (actual time=0.355..0.356 rows=1 loops=1,000)

7. 20.000 350.000 ↑ 61.0 1 1,000

Nested Loop (cost=0.29..1,977.56 rows=61 width=8) (actual time=0.214..0.350 rows=1 loops=1,000)

8. 9.000 9.000 ↑ 1.0 1 1,000

Index Only Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales es (cost=0.29..2.31 rows=1 width=4) (actual time=0.006..0.009 rows=1 loops=1,000)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)
  • Heap Fetches: 0
9. 136.550 321.000 ↑ 61.0 1 1,000

Index Scan using empleados_npatronal_idx on empleados (cost=0.00..1,974.64 rows=61 width=24) (actual time=0.189..0.321 rows=1 loops=1,000)

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

SubPlan (forIndex Scan)

11. 4.650 184.450 ↑ 1.0 1 1,550

Limit (cost=14.15..14.15 rows=1 width=20) (actual time=0.119..0.119 rows=1 loops=1,550)

12. 15.500 179.800 ↑ 1.0 1 1,550

Sort (cost=14.15..14.15 rows=1 width=20) (actual time=0.116..0.116 rows=1 loops=1,550)

  • Sort Key: empleados_movimientos.fecha, empleados_movimientos.id
  • Sort Method: quicksort Memory: 25kB
13. 15.500 164.300 ↑ 1.0 1 1,550

Result (cost=0.43..14.14 rows=1 width=20) (actual time=0.093..0.106 rows=1 loops=1,550)

  • One-Time Filter: (empleados.empresa_id = emp.id)
14. 110.938 148.800 ↑ 1.0 1 1,550

Index Scan using empleados_movimientos_empleado_id_tipo_idx on empleados_movimientos (cost=0.43..14.13 rows=1 width=20) (actual time=0.089..0.096 rows=1 loops=1,550)

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

SubPlan (forIndex Scan)

16. 37.862 37.862 ↓ 0.0 0 1,721

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

  • Index Cond: (id_registro_multado = empleados_movimientos.id)
  • Filter: ((estado IS NULL) AND (idtipo_multa = 11))
  • Rows Removed by Filter: 0