Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 659062E0081 for ; Fri, 11 Apr 2008 07:37:15 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01117-03 for ; Fri, 11 Apr 2008 07:37:09 -0300 (ADT) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by developer.postgresql.org (Postfix) with ESMTP id B061E2E007F for ; Fri, 11 Apr 2008 07:37:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from h07.llord.com (unknown [195.140.142.194]) by mx1.hub.org (Postfix) with ESMTP id BE54DB077B9 for ; Fri, 11 Apr 2008 07:37:03 -0300 (ADT) Received: from par69-8-88-161-102-87.fbx.proxad.net ([88.161.102.87] helo=apollo13.peufeu.com) by h07.llord.com with esmtpa (Exim 4.68) (envelope-from ) id 1JkGcu-0004tp-AN; Fri, 11 Apr 2008 12:37:00 +0200 Date: Fri, 11 Apr 2008 12:41:15 +0200 To: "kevin kempter" , pgsql-performance@postgresql.org Subject: Re: Partitioned tables - planner wont use indexes From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: User-Agent: Opera Mail/9.24 (Linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - h07.llord.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - peufeu.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.078 tagged_above=0 required=5 tests=AWL=0.668, SUBJECT_FUZZY_TION=0.41 X-Spam-Level: * X-Archive-Number: 200804/148 X-Sequence-Number: 29641 > I tried removing the index from the part_master table and got the same= = > result Since all the data is in the partitions, the part_master table is empty= , = so the index is not useful for your query. > myDB=3D# explain SELECT min(logdate) FROM part_master; Proposals : 1- Use plpgsql to parse the system catalogs, get the list of partitions= , = and issue a min() query against each 2- Since dates tend to be incrementing, I guess the minimum date must n= ot = be changing that often (unless you delete rows) ; therefore if you need = = that information often I suggest a trigger that updates a separate table= = which keeps the min_date (perhaps global or for each client, you choose)= .