Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F13C5475E3E for ; Tue, 15 Oct 2002 04:45:15 -0400 (EDT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id 0BC19475E2B for ; Tue, 15 Oct 2002 04:45:15 -0400 (EDT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 181NKA-0007BT-0U; Tue, 15 Oct 2002 09:45:13 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 81B671736C; Tue, 15 Oct 2002 09:24:05 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id D6D1A1736A; Tue, 15 Oct 2002 09:24:04 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Keith Gray Subject: Re: Slow performance on MAX(primary_key) Date: Tue, 15 Oct 2002 09:23:15 +0100 User-Agent: KMail/1.4.3 Cc: PostgreSQL Mailing List References: <20021015071628.57518.qmail@web80304.mail.yahoo.com> <3DABC801.8060902@heart.com.au> In-Reply-To: <3DABC801.8060902@heart.com.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210150923.15822.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/155 X-Sequence-Number: 9872 On Tuesday 15 Oct 2002 8:47 am, Keith Gray wrote: > Ludwig Lim wrote: > > As of now, Max() doesn't utilizes the indices hence > > it always do a sequential scan. > > Thanks Ludwig, > > That does help performance, but I was using a "standard" > SQL command wrapped in a VB6 ADO ODBC program. > > Is this likely to be sorted in 7.2 ? > Is anyone looking at this? As I understand, the problem is that the optimisation only applies for simp= le=20 cases, and for certain aggregate functions (e.g. not sum()). This means tha= t=20 the parser would need special-case code to spot these cases, along with tag= s=20 for those functions that can be optimised. Thinking further, it might also= =20 vary from type to type. Given that there is a simple workaround and the nee= d=20 for the optimisation to be added cleanly to the code I believe this has a= =20 fairly low priority. There is a todo list on the developers' side of the website which has a lis= t=20 of changes in upcoming releases, you could check there for details. --=20 Richard Huxton