On Mon, 6 Sep 2004, [iso-8859-15] Pierre-Frédéric Caillaud wrote: > Why is it that way ? The planner should use the LIMIT values when > planning the query, should it not ?
And it do use limit values, the estimated cost was lower when you had the limit, What you need to do is to tune pg for your computer. For example the following settings: * effective_cache - this setting tells pg how much the os are caching (for example use top to find out during a normal work load). You said that the tables fit in memory and by telling pg how much is cached it might adjust it's plans accordingly. * random_page_cost - how expensive is a random access compared to seq. access. This is dependent on the computer and disk system you have. If the setting above does not help, maybe you need to lower this to variable to 2 or something. And don't forget the shared_buffer setting. But most people usually have it tuned in my experience (but usually too high). Here is an article that might help you: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html -- /Dennis Björklund ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend