Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 61EF847624C for ; Wed, 18 Sep 2002 16:13:53 -0400 (EDT) Received: from wolff.to (wolff.to [66.93.197.35]) by postgresql.org (Postfix) with SMTP id AAE5C4761ED for ; Wed, 18 Sep 2002 16:13:52 -0400 (EDT) Received: (qmail 4394 invoked by uid 500); 18 Sep 2002 20:21:44 -0000 Date: Wed, 18 Sep 2002 15:21:44 -0500 From: Bruno Wolff III To: Laurette Cisneros Cc: pgsql-admin@postgresql.org Subject: Re: index performance question Message-ID: <20020918202144.GA4371@wolff.to> Mail-Followup-To: Laurette Cisneros , pgsql-admin@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/223 X-Sequence-Number: 5762 On Wed, Sep 18, 2002 at 13:09:07 -0700, Laurette Cisneros wrote: > > Aren't aggregates smart enough to use an index on the column? This takes 8 > minutes to run! I can't see that I should have to build a functional index > (is it possible for an aggregate?) to get this to run faster? I don't believe a functional index would work for an aggregate. The way to do this is to use an order by clause and a limit 1 clause. This has been discussed a lot on the lists and you should be able to find more details in the archives.