Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 6D4E8475A19 for ; Tue, 30 Jul 2002 17:45:18 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id C5671D60C; Tue, 30 Jul 2002 14:45:16 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id A0DCB5C03; Tue, 30 Jul 2002 14:45:16 -0700 (PDT) Date: Tue, 30 Jul 2002 14:45:16 -0700 (PDT) From: Stephan Szabo To: Josh Berkus Cc: Subject: Re: COUNT DISTINCT? In-Reply-To: <200207301427.18815.josh@agliodbs.com> Message-ID: <20020730144457.J9060-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200207/453 X-Sequence-Number: 8831 On Tue, 30 Jul 2002, Josh Berkus wrote: > Folks, > > Anybody know a keen shortcut for the following: > > SELECT count(skip_date) > FROM (SELECT DISTINCT skip_date FROM weekend_list > WHERE ... ...) days_to_skip; > > That's a double aggregate, and is bound to be dog-slow. Would that be the same as: select count(distinct skip_date) from weekend_list where ...