X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 671F49FB46B for ; Fri, 25 Aug 2006 01:33:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 66009-03 for ; Fri, 25 Aug 2006 01:33:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6B9829FB462 for ; Fri, 25 Aug 2006 01:33:30 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k7P4XS8n018395; Fri, 25 Aug 2006 00:33:28 -0400 (EDT) To: "Joshua D. Drake" cc: Sriram Dandapani , "Pgsql-Performance (E-mail)" Subject: Re: select max(column) from parent table very slow In-reply-to: <44EE4DA1.5060701@commandprompt.com> References: <6992E470F12A444BB787B5C937B9D4DF057500BF@ca-mail1.cis.local> <44EE4DA1.5060701@commandprompt.com> Comments: In-reply-to "Joshua D. Drake" message dated "Thu, 24 Aug 2006 18:08:49 -0700" Date: Fri, 25 Aug 2006 00:33:27 -0400 Message-ID: <18394.1156480407@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.145 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/402 X-Sequence-Number: 20587 "Joshua D. Drake" writes: > Sriram Dandapani wrote: >> Parent table has a column say column1 which is indexed (parent table and >> all child tables are indexed on that column) > In older versions of postgresql that would scan the whole table. In 8.1 > and above it doesn't. However, I am guess that since this is a > partitioned table the planner isn't smart enough to just perform the > query on each child and a max on the set that is returned. It is not. Feel free to submit a patch for planagg.c ... regards, tom lane