Re: [PERFORM] Interesting query plan change linked to the LIMIT parameter

2009-01-21 Thread Yannick Le Guédart
Thanks for the rapid response. I can understand the way the planner makes its guess, but as a matter of fact, he'll be nearly always wrong, just becausethe most commented articles have only around 5000 or so comments. I ran the explain analyze tonight and got this results : EXPLAIN ANALYZE SELE

Re: [PERFORM] Interesting query plan change linked to the LIMIT parameter

2009-01-20 Thread David Wilson
On Tue, Jan 20, 2009 at 10:45 AM, Yannick Le Guédart wrote: > > The second query scans the whole comment table which is very dangerous for > production servers. That's not quite true. The second does an index scan- the planner seems to be guessing that it'll fulfill the required limit early in t

[PERFORM] Interesting query plan change linked to the LIMIT parameter

2009-01-20 Thread Yannick Le Guédart
Greetings, I'm experiencing a strange query plan change on a "simple" request, based on the LIMIT parameter. I present here two tables, named _article and _comment. they are part of a much larger database. It's a tree-like database (making use of the ltree to keep the coherence), and in our case,