Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 41872475AA1 for ; Wed, 16 Oct 2002 20:49:50 -0400 (EDT) Received: from gateway.heart.com.au (202-44-184-121.nexnet.net.au [202.44.184.121]) by postgresql.org (Postfix) with ESMTP id 3BFDF4760D5 for ; Wed, 16 Oct 2002 20:49:48 -0400 (EDT) Received: from tardis.heart.com.au (IDENT:root@tardis.heart.com.au [192.168.0.42]) by gateway.heart.com.au (8.11.6/8.11.2) with ESMTP id g9H1QgI29949; Thu, 17 Oct 2002 11:26:42 +1000 Received: from heart.com.au ([192.168.0.53]) by tardis.heart.com.au (8.9.3/8.8.7) with ESMTP id KAA12902; Thu, 17 Oct 2002 10:49:09 +1000 Message-ID: <3DAE0883.6090709@heart.com.au> Date: Thu, 17 Oct 2002 10:46:59 +1000 From: Keith Gray User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3 X-Accept-Language: en-us MIME-Version: 1.0 To: Richard Huxton Cc: PostgreSQL Mailing List Subject: Re: Slow performance on MAX(primary_key) References: <20021015071628.57518.qmail@web80304.mail.yahoo.com> <3DABC801.8060902@heart.com.au> <200210150923.15822.dev@archonet.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/185 X-Sequence-Number: 9902 Richard Huxton wrote: >>> As of now, Max() doesn't utilizes the indices hence >>>it always do a sequential scan. >>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 simple > cases... Getting MIN() adn MAX() seems fairly trivial to me. When is on an index or more importantly Primary Key it must be a common SQL. Would it be possible in the code to look at the field in MIN() or MAX() and if it is indexed use a similar method to the suggested SQL work around? Can I help this to happen? -- Keith Gray Technical Services Manager Heart Consulting Services