Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 3074A9FB6DB for ; Mon, 30 Apr 2007 10:45:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 19594-06 for ; Mon, 30 Apr 2007 10:45:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 262E19FB6D1 for ; Mon, 30 Apr 2007 10:45:17 -0300 (ADT) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 594F175371; Mon, 30 Apr 2007 14:45:06 +0100 (BST) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 279A32740E5; Mon, 30 Apr 2007 14:45:12 +0100 (BST) Message-ID: <4635F2E1.3090602@archonet.com> Date: Mon, 30 Apr 2007 14:45:05 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Andreas Haumer Cc: Guillaume Cottenceau , pgsql-performance@postgresql.org Subject: Re: Query performance problems with partitioned tables References: <4635D678.3050205@xss.co.at> <87ps5mgghp.fsf@meuh.mnc.lan> <4635EF3A.1070204@xss.co.at> In-Reply-To: <4635EF3A.1070204@xss.co.at> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/502 X-Sequence-Number: 24379 Andreas Haumer wrote: > > I think the planner could do the following: > > a) It could make a better decision in which direction to scan > the partitions (depending on sort order involved in the query) > > b) It could stop scanning as soon as there can not be any further > resulting row according to the CHECK constraints given on the tables. [snip] > Perhaps the logic to implement this is complex, but IMHO > it _should_ be doable (and proofable), shouldn't it? Ah, it might be do-able for some subset of cases, but is it cost-effective to check for in *all* cases? Don't forget the constraints and where clauses can be arbitrarily complex. -- Richard Huxton Archonet Ltd