Bradley Baetz <bbaetz@acm.org> writes:
> By cached, do you mean PREPARE stuff, or something else?
PREPARE, and cached plans in plpgsql, and cached plans in SPI, and
cached plans for foreign keys (though probably those never use IN)
and perhaps other places I'm not thinking of at the moment.
> However, its much faster (although not as fast as sticking the DISTINCT
> in there myself), but the actual rows coming from the sort is really odd
> - where is that number coming from? How can sorting 9 rows take 44476
> anythings?
We're back full circle to my original comment about rescans in
mergejoin. The EXPLAIN ANALYZE instrumentation counts a re-fetch
as another returned row.
regards, tom lane