Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id ADDE5133655C for ; Mon, 11 Oct 2010 17:58:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 80505-07 for ; Mon, 11 Oct 2010 20:58:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lpo-relay-04.vmsinfo.com (lpo-relay-04.vmsinfo.com [216.169.137.115]) by mail.postgresql.org (Postfix) with ESMTP id 584591337B5A for ; Mon, 11 Oct 2010 17:58:39 -0300 (ADT) X-IronPort-AV: E=Sophos;i="4.57,316,1283745600"; d="scan'208";a="26240839" Received: from unknown (HELO lpo-mailbox-02.vmsinfo.com) ([216.169.137.251]) by lpo-relay-04.vmsinfo.com with ESMTP; 11 Oct 2010 16:58:38 -0400 Received: from [10.101.43.35] (lpo-autonomy-p03.vmsinfo.com [216.169.135.234]) by lpo-mailbox-02.vmsinfo.com (Postfix) with ESMTP id 16A6556236; Mon, 11 Oct 2010 16:58:38 -0400 (EDT) Message-ID: <4CB37A7D.90502@vmsinfo.com> Date: Mon, 11 Oct 2010 16:58:37 -0400 From: Mladen Gogala Organization: VMS User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: Neil Whelchel CC: "pgsql-performance@postgresql.org" Subject: Re: Slow count(*) again... References: <201010091626.18636.neil.whelchel@gmail.com> <4CB34D69.6060108@emolecules.com> <201010111254.58479.neil.whelchel@gmail.com> In-Reply-To: <201010111254.58479.neil.whelchel@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/251 X-Sequence-Number: 40669 Neil Whelchel wrote: > > > That is why I suggested an estimate(*) that works like (a faster) count(*) > except that it may be off a bit. I think that is what he was talking about > when he wrote this. > > The main problem with "select count(*)" is that it gets seriously mis-used. Using "select count(*)" to establish existence is bad for performance and for code readability. -- Mladen Gogala Sr. Oracle DBA 1500 Broadway New York, NY 10036 (212) 329-5251 http://www.vmsinfo.com The Leader in Integrated Media Intelligence Solutions