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 8741ED1B4E1 for ; Fri, 10 Oct 2003 11:01:21 +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 74611-09 for ; Fri, 10 Oct 2003 08:00:38 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 9E098D1B522 for ; Fri, 10 Oct 2003 08:00:32 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h9AB5s8U020203 for ; Fri, 10 Oct 2003 16:35:54 +0530 Received: from persistent.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h9AB5qwc020173; Fri, 10 Oct 2003 16:35:53 +0530 Message-ID: <3F86914E.2070100@persistent.co.in> Date: Fri, 10 Oct 2003 16:30:30 +0530 From: Shridhar Daithankar Organization: Persistent Systems Pvt. Ltd. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030917 Thunderbird/0.3a X-Accept-Language: en-us, en MIME-Version: 1.0 To: Seth Ladd Cc: pgsql-performance@postgresql.org Subject: Re: way to speed up a SELECT DISTINCT? References: <9BE142FC-FB0F-11D7-A8D2-000A9576D038@picklematrix.net> In-Reply-To: <9BE142FC-FB0F-11D7-A8D2-000A9576D038@picklematrix.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/329 X-Sequence-Number: 4077 Seth Ladd wrote: >> peter@bernardo:express=# explain select distinct region from region; >> QUERY PLAN >> ----------------------------------------------------------------------- >> ----------------------- >> Unique (cost=0.00..4326.95 rows=9518 width=14) >> -> Index Scan using regionview_region on region (cost=0.00..4089.00 >> rows=95183 width=14) >> (2 rows) > > > Thanks for the tip, I'll give this a shot soon. I am curious, your > example above does not use GROUP BY yet you have an INDEX SCAN. I am > using a similar query, yet I get a full table scan. I wonder how they > are different? Have you tuned your shared buffers and effective cache correctly? Shridhar