Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 67AD69FB1E6 for ; Wed, 18 Oct 2006 18:34:15 -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 58899-07 for ; Wed, 18 Oct 2006 18:34:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from servata.com (ip-216-152-249-241.servata.com [216.152.249.241]) by postgresql.org (Postfix) with ESMTP id 4D24C9FA338 for ; Wed, 18 Oct 2006 18:34:10 -0300 (ADT) Received: from [209.162.219.253] (helo=dogma.v10.wvs) by servata.com with esmtpa (Exim 4.50) id 1GaJ2u-0006po-R8; Wed, 18 Oct 2006 14:33:53 -0700 Subject: Re: Postgresql 8.1.4 - performance issues for select on From: Jeff Davis To: Dimitri Fontaine Cc: pgsql-performance@postgresql.org, Ioana Danes In-Reply-To: <200610182319.41920.dim@dalibo.com> References: <20061018210201.56435.qmail@web55907.mail.re3.yahoo.com> <200610182319.41920.dim@dalibo.com> Content-Type: text/plain; charset=utf-8 Date: Wed, 18 Oct 2006 14:33:49 -0700 Message-Id: <1161207230.31645.266.camel@dogma.v10.wvs> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-7) Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.228 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, SPF_HELO_PASS X-Spam-Level: X-Archive-Number: 200610/380 X-Sequence-Number: 21509 On Wed, 2006-10-18 at 23:19 +0200, Dimitri Fontaine wrote: > Le mercredi 18 octobre 2006 23:02, Ioana Danes a =C3=A9crit : > > I tried the partitioning scenario but I've got into > > the same problem. The max function is not using the > > indexes on the two partitioned tables... > > > > Any other thoughts? >=20 > Did you make sure your test included table inheritance? > I'm not sure the planner benefits from constraint_exclusion without selec= ting=20 > the empty parent table (instead of your own union based view). >=20 constraint exclusion and inheritance won't help him. The problem is that he has two indexes, and he needs to find the max between both of them. PostgreSQL isn't smart enough to recognize that it can use two indexes, find the max in each one, and find the max of those two values. Regards, Jeff Davis