Kelly Burkhart <kelly(at)tradebotsystems(dot)com> writes:
> The critical part is driving the fill table query from a sequential scan
> rather than a scan of fill_ak2.
Have you done an ANALYZE or VACUUM ANALYZE lately? If so, what do you
get from
select * from pg_stats where tablename = 'fill';
select * from pg_class where relname = 'fill';
Offhand I am guessing that the table is fairly well ordered by fill_ts
and the planner is underestimating the effects of this. There is a
provision in there to try to account for data ordering, but it's new
code in 7.2 and doubtless still needs refinement.
regards, tom lane