X-Original-To: pgsql-performance@postgresql.org Received: from cat (adsl-66-123-169-52.dsl.sntc01.pacbell.net [66.123.169.52]) by postgresql.org (Postfix) with ESMTP id 8E77C476356 for ; Wed, 12 Mar 2003 20:00:17 -0500 (EST) Received: by cat (Postfix, from userid 501) id 45973B6D69; Wed, 12 Mar 2003 17:00:19 -0800 (PST) Date: Wed, 12 Mar 2003 17:00:19 -0800 From: Max Baker To: Chad Thompson Cc: PostgreSQL Performance Mailing List Subject: Re: speeding up COUNT and DISTINCT queries Message-ID: <20030313010018.GN30411@warped.org> References: <20030312223811.GM30411@warped.org> <0ca601c2e8ea$6f7783d0$32021aac@chad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0ca601c2e8ea$6f7783d0$32021aac@chad> User-Agent: Mutt/1.5.3i X-Archive-Number: 200303/89 X-Sequence-Number: 1387 On Wed, Mar 12, 2003 at 03:55:09PM -0700, Chad Thompson wrote: > Ive found that group by works faster than distinct. > > Try > EXPLAIN ANALYZE select mac from node group by mac; This was about 25% faster, thanks! That will work for distinct() only calls, but I still am looking for a way to speed up the count() command. Maybe an internal counter of rows, and triggers? -m