[PERFORM] LIMIT on partitioned-table!?

2011-02-15 Thread Kim A. Brandt
Hello list, does `postgres (PostgreSQL) 8.4.5' use the LIMIT of a query when it is run on a partitioned-table or am I doing something wrong? It looks as if postgres queries all partitions and then LIMITing the records afterwards!? This results in a long (3 minutes) running query. What can I

Re: [PERFORM] LIMIT on partitioned-table!?

2011-02-15 Thread Shaun Thomas
On 02/15/2011 08:23 AM, Kim A. Brandt wrote: does `postgres (PostgreSQL) 8.4.5' use the LIMIT of a query when it is run on a partitioned-table or am I doing something wrong? It looks as if postgres queries all partitions and then LIMITing the records afterwards!? This results in a long (3

Re: [PERFORM] LIMIT on partitioned-table!?

2011-02-15 Thread Kim A. Brandt
Thank you Shaun, removing the ORDER BY worked. But I am afraid to ask this. How can I order by partition? It seams that the planner has picked a random(!?) order of partition to select from. The returned records, from the selected partition, are correctly sorted bythe index though. On

Re: [PERFORM] LIMIT on partitioned-table!?

2011-02-15 Thread Marti Raudsepp
On Tue, Feb 15, 2011 at 21:33, Kim A. Brandt kimabra...@gmx.de wrote: removing the ORDER BY worked. But I am afraid to ask this. How can I order by partition? It seams that the planner has picked a random(!?) order of partition to select from. The returned records, from the selected partition,

Re: [PERFORM] LIMIT on partitioned-table!?

2011-02-15 Thread Kim A. Brandt
Thank you Marti, I will go with the ``reduced number of matched rows'' and naturally be waiting for postgres 9.1 expectantly. Kind regards, Kim On 2011-02-15 22:13, Marti Raudsepp wrote: On Tue, Feb 15, 2011 at 21:33, Kim A. Brandtkimabra...@gmx.de wrote: removing the ORDER BY worked.