X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 81F98D1B528 for ; Mon, 8 Sep 2003 21:26:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 25330-10 for ; Mon, 8 Sep 2003 18:26:35 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 044C5D1B51B for ; Mon, 8 Sep 2003 18:26:29 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h88LQGAn003304; Mon, 8 Sep 2003 17:26:16 -0400 (EDT) To: "scott.marlowe" Cc: Neil Conway , Pailloncy =?ISO-8859-1?Q?Jean-G=E9rard?= , PostgreSQL Performance Subject: Re: slow plan for min/max In-reply-to: References: Comments: In-reply-to "scott.marlowe" message dated "Mon, 08 Sep 2003 14:37:10 -0600" Date: Mon, 08 Sep 2003 17:26:16 -0400 Message-ID: <3303.1063056376@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/128 X-Sequence-Number: 3494 "scott.marlowe" writes: > On Mon, 8 Sep 2003, Neil Conway wrote: >> As was pointed out in a thread a couple days ago, MIN/MAX() optimization >> has absolutely nothing to do with MVCC. It does, however, make >> optimizing COUNT() more difficult. > Not exactly. While max(id) is easily optimized by query replacement, > more complex aggregates will still have perfomance issues that would not > be present in a row locking database. i.e. max((field1/field2)*field3) is > still going to cost more to process, isn't it? Er, what makes you think that would be cheap in any database? Postgres would actually have an advantage given its support for expressional indexes (nee functional indexes). If we had an optimizer transform to convert MAX() into an index scan, I would expect it to be able to match up max((field1/field2)*field3) with an index on ((field1/field2)*field3). regards, tom lane