Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2A9651337C1A for ; Tue, 12 Oct 2010 12:15:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 57019-02-2 for ; Tue, 12 Oct 2010 15:15:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mail.postgresql.org (Postfix) with ESMTP id 03A871337BD6 for ; Tue, 12 Oct 2010 12:12:56 -0300 (ADT) Received: by wwb13 with SMTP id 13so1550453wwb.19 for ; Tue, 12 Oct 2010 08:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=KlPX+D+5pikkVVbnw7v1tcL5mn7lr8z542jEVo5GT5Q=; b=isqop0dkfn6vH+Dbo9jDp1Im7Y9ptLWbspOV7mA+GRoYWpPWpWqGQMXco6YVvo/x2c 7JG8hV/W552PT9EKFaEj09HMevXkmFAnA4v/P7cyilCQYlGXD2fy1v9Qv8kM2bwWk6Mj NVhhhzIyvZ+VQ7RPoSfhYtwiZ4s5yYSmKRmHE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=E+MdCRUqCFZbR/HcCh0dJLlrrhSgxZ7PXmOlrFoH8oIu6jJGg+mtd1ku4/siJpXDbB P+M2o+gIct/gHv868wrJLmij+X9w8XBcsywIOv7+MDQtzMRzT7sKHXjtXrmdTd57quxu bNOyYk416a3ga/MOAXlgLKbvigGiOjx4J2fuA= MIME-Version: 1.0 Received: by 10.216.188.132 with SMTP id a4mr6950151wen.61.1286896374245; Tue, 12 Oct 2010 08:12:54 -0700 (PDT) Received: by 10.216.157.206 with HTTP; Tue, 12 Oct 2010 08:12:53 -0700 (PDT) In-Reply-To: <201010091626.18636.neil.whelchel@gmail.com> References: <201010091626.18636.neil.whelchel@gmail.com> Date: Tue, 12 Oct 2010 08:12:53 -0700 Message-ID: Subject: Re: Slow count(*) again... From: bricklen To: Neil Whelchel Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/154 X-Sequence-Number: 40573 On Sat, Oct 9, 2010 at 4:26 PM, Neil Whelchel wrote: > Maybe an > estimate(*) that works like count but gives an answer from the index without > checking visibility? I am sure that this would be good enough to make a page > list, it is really no big deal if it errors on the positive side, maybe the > list of pages has an extra page off the end. I can live with that. What I > can't live with is taking 13 seconds to get a page of results from 850,000 > rows in a table. > -Neil- > FWIW, Michael Fuhr wrote a small function to parse the EXPLAIN plan a few years ago and it works pretty well assuming your stats are up to date. http://markmail.org/message/gknqthlwry2eoqey