explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PbqW

Settings
# exclusive inclusive rows x rows loops node
1. 1.605 120.448 ↑ 1.0 1,000 1

Limit (cost=6.25..4,475.22 rows=1,000 width=115) (actual time=4.036..120.448 rows=1,000 loops=1)

2. 5.658 118.843 ↑ 2,270.8 1,000 1

Nested Loop Left Join (cost=6.25..10,147,958.98 rows=2,270,761 width=115) (actual time=4.035..118.843 rows=1,000 loops=1)

3. 5.348 77.185 ↑ 2,270.8 1,000 1

Nested Loop Left Join (cost=5.82..5,196,599.20 rows=2,270,761 width=96) (actual time=4.027..77.185 rows=1,000 loops=1)

4. 3.903 12.837 ↑ 2,270.8 1,000 1

Merge Right Join (cost=5.39..243,828.97 rows=2,270,761 width=95) (actual time=3.997..12.837 rows=1,000 loops=1)

  • Merge Cond: (empresas_sucursales.nro_patronal = cabsueldos.nropatronal)
5. 4.656 7.880 ↑ 1,529.1 2,190 1

Merge Left Join (cost=4.96..166,093.56 rows=3,348,712 width=91) (actual time=0.056..7.880 rows=2,190 loops=1)

  • Merge Cond: (empresas_sucursales.nro_patronal = empleado.nropatronal)
6. 0.400 0.400 ↑ 3,104.3 19 1

Index Scan using empresas_sucursales_nro_patronal_key on empresas_sucursales (cost=0.29..47,866.09 rows=58,981 width=100) (actual time=0.014..0.400 rows=19 loops=1)

7. 2.824 2.824 ↑ 1,534.0 2,183 1

Index Only Scan using unkempleado on empleado (cost=0.43..76,221.11 rows=3,348,712 width=11) (actual time=0.037..2.824 rows=2,183 loops=1)

  • Heap Fetches: 0
8. 0.955 1.054 ↑ 40.0 1,000 1

Materialize (cost=0.42..37,204.32 rows=39,995 width=8) (actual time=0.023..1.054 rows=1,000 loops=1)

9. 0.099 0.099 ↑ 3,635.9 11 1

Index Scan using cabsueldos_nropatronal_anho_idx on cabsueldos (cost=0.42..37,104.34 rows=39,995 width=8) (actual time=0.019..0.099 rows=11 loops=1)

  • Index Cond: (anho = 2018)
  • Filter: (confirmado = 1)
10. 59.000 59.000 ↑ 1.0 1 1,000

Index Scan using persons_docs_valor_idx on persons_docs (cost=0.43..2.17 rows=1 width=15) (actual time=0.058..0.059 rows=1 loops=1,000)

  • Index Cond: ((empleado.documento)::text = (valor)::text)
11. 36.000 36.000 ↑ 1.0 1 1,000

Index Scan using persons_pk on persons (cost=0.43..2.17 rows=1 width=35) (actual time=0.034..0.036 rows=1 loops=1,000)

  • Index Cond: (persons_docs.person_id = id)