Re: [PERFORM] Slow query when using ORDER BY *and* LIMIT

2011-10-15 Thread Michael Viscuso
Dave, Since I control the application that was performing the query and I've separated my data into daily partitioned tables (which enforced my order by clause on a macro-level), I took Stephen's advice and implemented the nested loop over each daily table from within the application versus

Re: [PERFORM] Slow query when using ORDER BY *and* LIMIT

2011-10-13 Thread davidsarmstrong
I'm running into the same problem. I removed the limit and it was fine. I guess I could have removed the order by as well but it doesn't help if you really need both. Have you found any more information on this? Thanks! Dave (Armstrong) -- View this message in context:

Re: [PERFORM] Slow query when using ORDER BY *and* LIMIT

2011-07-08 Thread Jonathan
Does anyone have any suggestions for my problem? (I have to wonder if I'm somehow just not getting peoples attention or what. This is my second question this week on a public mailing list that has gotten exactly 0 replies) Jonathan On 7/5/2011 8:18 PM, Jonathan wrote: I have a query that

Re: [PERFORM] Slow query when using ORDER BY *and* LIMIT

2011-07-08 Thread Pavel Stehule
Hello Is impossible to help you without more detailed info about your problems, we have to see a execution plan, we have to see slow query Regards Pavel Stehule 2011/7/9 Jonathan jonat...@kc8onw.net: Does anyone have any suggestions for my problem?  (I have to wonder if I'm somehow just not

Re: [PERFORM] Slow query when using ORDER BY *and* LIMIT

2011-07-08 Thread Pavel Stehule
Hello sorry, I didn't see a link on privatepastebin There is problem in LIMIT, because query without LIMIT returns only a few lines more than query with LIMIT. You can try to materialize query without LIMIT and then to use LIMIT like SELECT * FROM (your query without limit OFFSET 0) x LIMIT 30;

[PERFORM] Slow query when using ORDER BY *and* LIMIT

2011-07-05 Thread Jonathan
I have a query that uses ORDER BY and LIMIT to get a set of image data rows that match a given tag. When both ORDER BY and LIMIT are included for some reason the planner chooses a very slow query plan. Dropping one or the other results in a much faster query going from 4+ seconds - 30 ms.