X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A05B35318D for ; Sun, 14 Aug 2005 22:37:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26437-04 for ; Mon, 15 Aug 2005 01:37:41 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id D9E8F53186 for ; Sun, 14 Aug 2005 22:37:40 -0300 (ADT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1E4Tv4-0002hi-AJ for pgsql-performance@postgresql.org; Mon, 15 Aug 2005 03:37:43 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1E4Tv3-0008Vq-00 for ; Mon, 15 Aug 2005 03:37:41 +0200 Date: Mon, 15 Aug 2005 03:37:41 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Performance pb vs SQLServer. Message-ID: <20050815013741.GA32106@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20050811131911.3175A1C0031B@mwinf0401.wanadoo.fr> <42FFE17A.6010208@arbash-meinel.com> <20050815010159.GA27795@uio.no> <14401.1124068725@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <14401.1124068725@sss.pgh.pa.us> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 required=5 tests=[AWL=0.016] X-Spam-Level: X-Archive-Number: 200508/153 X-Sequence-Number: 13900 On Sun, Aug 14, 2005 at 09:18:45PM -0400, Tom Lane wrote: > Not really. There's been some speculation about implementing index > "skip search" --- once you've verified there's at least one visible > row of a given index value, tell the index to skip to the next different > value instead of handing back any of the remaining entries of the > current value. But it'd be a lot of work and AFAICS not useful for > very many kinds of queries besides this. This is probably a completely wrong way of handling it all, but could it be done in a PL/PgSQL query like this? (Pseudo-code, sort of; I'm not very well versed in the actual syntax, but I'd guess you get the idea.) x = ( SELECT foo FROM table ORDER BY foo LIMIT 1 ); WHILE x IS NOT NULL RETURN NEXT x; x = ( SELECT foo FROM table WHERE foo > x ORDER BY foo LIMIT 1 ); END; (Replace with max() and min() for 8.1, of course.) /* Steinar */ - fond of horrible hacks :-) -- Homepage: http://www.sesse.net/