On Tue, 2006-08-08 at 22:14, Tom Lane wrote: > So some kind of override for statistical guesses doesn't seem completely > silly to me. But it needs to be declarative information that's stored > somewhere out of view of the actual SQL queries. IMHO anyway.
The real problem is that sometimes there's no way to get a better plan without some code change in the planner. And given the postgres release policy, that might be as far as 1 year away for a normal user... of course it's open source, you can patch, but would I trust a patch which is not tested by the community ? So mostly I can't wait for code changes, and then a generic tool to fix _now_ the one bad query which brings my system down would be nice. This is why hints would be nice, to quick-fix immediate problems. Of course they can and would be abused, as anything else. On the planner improvements part, would it be possible to save statistics about join criteria between tables ? I'm not sure where that would belong, but I guess it would be possible to have a special kind of ANALYZE which analyzes multiple tables and their correlations... this way the user would not need to hard-code the statistics hints, but the system could generate them. Cheers, Csaba. ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend