explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FC9H

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 3,509.628 ↓ 2.9 200 1

Limit (cost=107,393.10..107,393.27 rows=70 width=19) (actual time=3,509.609..3,509.628 rows=200 loops=1)

2. 17.676 3,509.620 ↓ 2.9 200 1

Sort (cost=107,393.10..107,393.27 rows=70 width=19) (actual time=3,509.609..3,509.620 rows=200 loops=1)

  • Sort Key: h3.id_habitante, h3.id_registro
  • Sort Method: top-N heapsort Memory: 40kB
3. 31.419 3,491.944 ↓ 1,079.1 75,537 1

Nested Loop (cost=106,670.09..107,390.95 rows=70 width=19) (actual time=1,554.042..3,491.944 rows=75,537 loops=1)

4. 113.771 1,604.450 ↓ 1,660.2 142,775 1

HashAggregate (cost=106,669.67..106,670.53 rows=86 width=12) (actual time=1,554.006..1,604.450 rows=142,775 loops=1)

5. 696.250 1,490.679 ↓ 1,683.1 144,748 1

Hash Join (cost=48,842.06..106,669.24 rows=86 width=12) (actual time=610.485..1,490.679 rows=144,748 loops=1)

  • Hash Cond: ((h.id_habitante = h1.id_habitante) AND ((max(h.fecha_real)) = h1.fecha_real))
6. 77.418 185.266 ↓ 1.5 142,775 1

GroupAggregate (cost=0.42..23,475.93 rows=97,945 width=12) (actual time=0.054..185.266 rows=142,775 loops=1)

7. 107.848 107.848 ↑ 1.0 474,572 1

Index Only Scan using phistorico_norden6 on phistorico h (cost=0.42..20,123.49 rows=474,597 width=12) (actual time=0.048..107.848 rows=474,572 loops=1)

  • Index Cond: ((cd_prov_ent = '46'::text) AND (cd_mun_ent = '131'::text) AND (fecha_real <= '2018-12-31 00:00:00'::timestamp without time zone))
  • Heap Fetches: 0
8. 117.145 609.163 ↑ 1.0 475,288 1

Hash (cost=38,927.32..38,927.32 rows=475,288 width=20) (actual time=609.163..609.163 rows=475,288 loops=1)

  • Buckets: 2048 Batches: 32 Memory Usage: 831kB
9. 492.018 492.018 ↑ 1.0 475,288 1

Seq Scan on phistorico h1 (cost=0.00..38,927.32 rows=475,288 width=20) (actual time=0.035..492.018 rows=475,288 loops=1)

  • Filter: (((cd_prov_ent)::text = '46'::text) AND ((cd_mun_ent)::text = '131'::text))
10. 1,856.075 1,856.075 ↑ 1.0 1 142,775

Index Scan using phistorico_norden1 on phistorico h3 (cost=0.42..8.36 rows=1 width=19) (actual time=0.013..0.013 rows=1 loops=142,775)

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