X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D65F2D7A64 for ; Fri, 2 Sep 2005 15:34:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87443-06 for ; Fri, 2 Sep 2005 18:34:00 +0000 (GMT) Received: from mail1.fluidhosting.com (mail1.fluidhosting.com [204.14.90.61]) by svr1.postgresql.org (Postfix) with SMTP id 27E8BD6E05 for ; Fri, 2 Sep 2005 15:33:58 -0300 (ADT) Received: (qmail 6947 invoked by uid 399); 2 Sep 2005 18:33:57 -0000 Received: from 81-174-7-77.f5.ngi.it (HELO ?127.0.0.1?) (81.174.7.77) by mail1.fluidhosting.com with SMTP; 2 Sep 2005 18:33:57 -0000 Message-ID: <43189B0F.2000904@beccati.com> Date: Fri, 02 Sep 2005 20:33:51 +0200 From: Matteo Beccati User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Simon Riggs Cc: pgsql-performance@postgresql.org Subject: Re: ORDER BY and LIMIT not propagated on inherited References: <43182789.4070307@beccati.com> <1125683697.3956.310.camel@localhost.localdomain> In-Reply-To: <1125683697.3956.310.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/62 X-Sequence-Number: 14370 Simon Riggs wrote: > Returning to Matteo's original query, what we are saying is that the new > optimization for MIN/MAX queries doesn't work with inherited tables. > > It could do, by running optimize_minmax_aggregates() for each query that > gets planned to see if a better plan exists for each child table. > > I think that's a TODO item. Great. Of course I'm using ORDER BY ... LIMIT as a workaround to get the index scan on pre-8.1, and because I'm used to it insted of the previously not optimized MIN/MAX aggregates. > Optimizing ORDER BY and LIMIT down looks like it would be harder to do > in the general case, even if Matteo's simple transform looks good. I'm > not sure it's a very common query type though... If I can find some time, I'll try to write some hacks... I just need to find out where to start ;) Best regards -- Matteo Beccati http://phpadsnew.com/ http://phppgads.com/