Re: [PERFORM] Why query takes soo much time

2011-05-16 Thread Tom Lane
Denis de Bernardy writes: > An alternative plan could have been to hash join the tables together, > to sort the result set, and to apply the limit/offset on the resulting > set. Indeed. I rather wonder why the planner didn't do that to start with. This plan looks to me like it might be suffering

Re: [PERFORM] Why query takes soo much time

2011-05-16 Thread Denis de Bernardy
[big nestloop with a huge number of rows] You're in an edge case, and I doubt you'll get things to run much faster: you want the last 1k rows out of an 18M row result set... It will be slow no matter what you do. What the plan is currently doing, is it's going through these 18M rows using a fo

Re: [PERFORM] Why query takes soo much time

2011-05-16 Thread Craig Ringer
On 05/16/2011 01:39 PM, Adarsh Sharma wrote: Dear all, I have a query on 3 tables in a database as :- _*Explain Analyze Output :-*_ explain anayze select c.clause, s.subject ,s.object , s.verb, s.subject_type , s.object_type ,s.doc_id ,s.svo_id from clause2 c, svo2 s ,page_content p where c.c