X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 336155384E for ; Tue, 29 Mar 2005 15:47:41 +0100 (BST) 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 72660-04 for ; Tue, 29 Mar 2005 14:47:38 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 7CFF553696 for ; Tue, 29 Mar 2005 15:47:36 +0100 (BST) Received: (qmail 32282 invoked by uid 500); 29 Mar 2005 15:04:18 -0000 Date: Tue, 29 Mar 2005 09:04:18 -0600 From: Bruno Wolff III To: T E Schmitz Cc: Scott Marlowe , pgsql-sql@postgresql.org Subject: Re: cost of CREATE VIEW ... AS SELECT DISTINCT Message-ID: <20050329150418.GA32031@wolff.to> Mail-Followup-To: T E Schmitz , Scott Marlowe , pgsql-sql@postgresql.org References: <42487A6D.6020506@numerixtechnology.de> <1112047463.22988.25.camel@state.g2switchworks.com> <424928D8.7060705@numerixtechnology.de> <20050329132941.GA27251@wolff.to> <4249564B.1000807@numerixtechnology.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4249564B.1000807@numerixtechnology.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/379 X-Sequence-Number: 20858 On Tue, Mar 29, 2005 at 14:21:15 +0100, T E Schmitz wrote: > > As far as I can see (via EXPLAIN), both DISTINCT and GROUP BY will lead > to a sequentail scan. Is that correct? If you need to read the whole table yes. However if you join the view to something else that might not be necessary. > If that's the case, I should come up with a different concept to obtain > a list of ORIGINs. That may be a good idea, especially if there are lots of rows for each origin value.