Tom,
> I've never fully understood the distinction the stats make between
> "tuples fetched" and "tuples returned", and it's even less obvious how
> to apply it when the index and heap operations are decoupled.
Well, it's mainly a counter to measure how many dead rows are in your active
data set. It probably belongs elsewhere, such as pg_stats_all_tables with
the overall fetch counts.
> In
> particular the function design assumes that heap tuple fetches can be
> tied to particular indexes, which is now a broken assumption. You
> might be amused by this test case I just finished debugging:
Well, I'd be in favor of moving the "useful" version of tuples_returned to
pg_stat_*_tables as an overall count. However, we cant drop the column from
pg_stat_indexes without breaking apps; at best, we'd have to warn people of
the accuracy issues and give it a few versions before we dropped it.
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco