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 96B5552B08 for ; Sun, 14 Aug 2005 22:02:04 -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 20018-08 for ; Mon, 15 Aug 2005 01:02:01 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 06B2452B0A for ; Sun, 14 Aug 2005 22:01:59 -0300 (ADT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1E4TMW-0002cN-Md for pgsql-performance@postgresql.org; Mon, 15 Aug 2005 03:02:02 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1E4TMV-0007Lx-00 for ; Mon, 15 Aug 2005 03:01:59 +0200 Date: Mon, 15 Aug 2005 03:01:59 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Performance pb vs SQLServer. Message-ID: <20050815010159.GA27795@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20050811131911.3175A1C0031B@mwinf0401.wanadoo.fr> <42FFE17A.6010208@arbash-meinel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <42FFE17A.6010208@arbash-meinel.com> 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.017 required=5 tests=[AWL=0.017] X-Spam-Level: X-Archive-Number: 200508/149 X-Sequence-Number: 13896 On Sun, Aug 14, 2005 at 07:27:38PM -0500, John Arbash Meinel wrote: > My guess is that this is part of a larger query. There isn't really much > you can do. If you want all 3.2M rows, then you have to wait for them to > be pulled in. To me, it looks like he'll get 88 rows, not 3.2M. Surely we must be able to do something better than a full sequential scan in this case? test=# create table foo ( bar char(4) ); CREATE TABLE test=# insert into foo values ('0000'); INSERT 24773320 1 test=# insert into foo values ('0000'); INSERT 24773321 1 test=# insert into foo values ('1111'); INSERT 24773322 1 test=# select * from foo group by bar; bar ------ 1111 0000 (2 rows) I considered doing some odd magic with generate_series() and subqueries with LIMIT 1, but it was a bit too weird in the end :-) /* Steinar */ -- Homepage: http://www.sesse.net/