Robins <tharakan@xxxxxxxxx> writes: > There is one thing though, that I couldn't really understand. Considering > that A's correlation in pg_stats being very high compared to B, isn't it 'a > better candidate' for a sequential scan as compared to B in this scenario ? No, high correlation reduces the cost of an indexscan but doesn't do anything much for a seqscan-and-sort. (Actually, I suppose it could help by reducing the number of initial runs to be merged, but that's not an effect the planner knows about.) The interesting point is that Paul shows SELECT tablename, attname, correlation FROM pg_stats where tablename='x'; x | a | 0.977819 x | b | 0.78292 when his initial verbal description indicated that b should have the better correlation. So that's something else odd about this case. regards, tom lane