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 64A87D1B527 for ; Mon, 8 Sep 2003 23:42:41 +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 53516-07 for ; Mon, 8 Sep 2003 20:42:33 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 6E6CAD1B520 for ; Mon, 8 Sep 2003 20:42:30 -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 h88NgWAn009769; Mon, 8 Sep 2003 19:42:32 -0400 (EDT) To: "Matt Clark" Cc: "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: slow plan for min/max In-reply-to: References: Comments: In-reply-to "Matt Clark" message dated "Tue, 09 Sep 2003 00:17:09 +0100" Date: Mon, 08 Sep 2003 19:42:31 -0400 Message-ID: <9768.1063064551@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/136 X-Sequence-Number: 3502 "Matt Clark" writes: > Actually, referring down to later parts of this thread, why can't this > optimisation be performed internally for built-in types? I understand the > issue with aggregates over user-defined types, but surely optimising max() > for int4, text, etc is safe and easy? I can't see that the datatype involved has anything to do with it. None of the issues that come up in making the planner do this are datatype-specific. You could possibly avoid adding some columns to pg_aggregate if you instead hard-wired the equivalent knowledge (for builtin types only) into some code somewhere, but a patch that approached it that way would be rejected as unmaintainable. regards, tom lane