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 A75C9D1B522 for ; Mon, 8 Sep 2003 22:08:00 +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 38034-06 for ; Mon, 8 Sep 2003 19:07:49 -0300 (ADT) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by svr1.postgresql.org (Postfix) with ESMTP id 8D15FD1B500 for ; Mon, 8 Sep 2003 19:07:46 -0300 (ADT) Received: from stark.dyndns.tv (gsstark.mtl.istop.com [66.11.160.162]) by smtp.istop.com (Postfix) with ESMTP id 98D7336974; Mon, 8 Sep 2003 18:07:48 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) id 19wUAm-0002wL-00; Mon, 08 Sep 2003 18:07:48 -0400 To: "scott.marlowe" Cc: =?iso-8859-1?q?Pailloncy_Jean-G=E9rard?= , Subject: Re: slow plan for min/max References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 08 Sep 2003 18:07:48 -0400 Message-ID: <87wucj3pe3.fsf@stark.dyndns.tv> Lines: 13 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/132 X-Sequence-Number: 3498 "scott.marlowe" writes: > Basically, Postgresql uses an MVCC locking system that makes massively As discussed, uh, a few days ago, this particular problem is not caused by MVCC but by postgres having a general purpose aggregate system and not having special code for handling min/max. Aggregates normally require access to every record they're operating on, not just the first or last in some particular order. You'll note the LIMIT 1/DISTINCT ON work-around works fine with MVCC... -- greg