explain.depesz.com

PostgreSQL's explain analyze made readable

Result: K8C6

Settings
# exclusive inclusive rows x rows loops node
1. 31.196 10,470.178 ↓ 75,537.0 75,537 1

Nested Loop (cost=104,117.68..135,253.09 rows=1 width=831) (actual time=6,200.821..10,470.178 rows=75,537 loops=1)

2. 63.841 8,154.582 ↓ 142,775.0 142,775 1

GroupAggregate (cost=104,117.26..135,244.62 rows=1 width=19) (actual time=6,200.757..8,154.582 rows=142,775 loops=1)

3. 485.147 8,090.741 ↓ 144,748.0 144,748 1

Merge Join (cost=104,117.26..135,244.60 rows=1 width=19) (actual time=6,200.739..8,090.741 rows=144,748 loops=1)

  • Merge Cond: (((h.cd_prov_ent)::text = (h1.cd_prov_ent)::text) AND ((h.cd_mun_ent)::text = (h1.cd_mun_ent)::text) AND (h.id_habitante = h1.id_habitante))
  • Join Filter: (h1.fecha_real = (max(h.fecha_real)))
  • Rows Removed by Join Filter: 330324
4. 110.540 228.335 ↓ 1.5 142,775 1

GroupAggregate (cost=0.42..23,472.47 rows=97,945 width=19) (actual time=0.065..228.335 rows=142,775 loops=1)

5. 117.795 117.795 ↑ 1.0 474,572 1

Index Only Scan using phistorico_norden6 on phistorico h (cost=0.42..17,747.05 rows=474,597 width=19) (actual time=0.057..117.795 rows=474,572 loops=1)

  • Index Cond: (fecha_real <= '2018-12-31 00:00:00'::timestamp without time zone)
  • Heap Fetches: 0
6. 49.891 7,377.259 ↑ 1.0 475,272 1

Materialize (cost=104,116.84..106,493.28 rows=475,288 width=27) (actual time=6,200.632..7,377.259 rows=475,272 loops=1)

7. 6,873.289 7,327.368 ↑ 1.0 475,272 1

Sort (cost=104,116.84..105,305.06 rows=475,288 width=27) (actual time=6,200.628..7,327.368 rows=475,272 loops=1)

  • Sort Key: h1.cd_prov_ent, h1.cd_mun_ent, h1.id_habitante
  • Sort Method: external merge Disk: 19472kB
8. 454.079 454.079 ↑ 1.0 475,288 1

Seq Scan on phistorico h1 (cost=0.00..36,550.88 rows=475,288 width=27) (actual time=0.017..454.079 rows=475,288 loops=1)

9. 2,284.400 2,284.400 ↑ 1.0 1 142,775

Index Scan using phistorico_norden3 on phistorico h3 (cost=0.42..8.45 rows=1 width=831) (actual time=0.016..0.016 rows=1 loops=142,775)

  • Index Cond: (((cd_prov_ent)::text = '46'::text) AND ((cd_mun_ent)::text = '131'::text) AND (id_registro = (max(h1.id_registro))))
  • Filter: (tipo_mov <> 'B'::bpchar)
  • Rows Removed by Filter: 0
Total runtime : 10,493.721 ms