From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steve Wampler <swampler@noao.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Make COUNT(*) Faster?
Date: Fri, 08 Jul 2005 12:12:23 -0400
Message-ID: <23283.1120839143@sss.pgh.pa.us> (raw)
In-Reply-To: <42CEA305.1050904@noao.edu>
References: <9EF2931D-1097-470D-8ECB-59D00166C96F@apple.com>
<60vf3mklue.fsf@dba2.int.libertyrms.com>
<42CE89CA.2070607@noao.edu>
<20050708143508.GD22725@wolff.to>
<42CE96AF.3020903@noao.edu>
<22916.1120836900@sss.pgh.pa.us>
<42CEA305.1050904@noao.edu>
Steve Wampler <swampler@noao.edu> writes:
> Tom Lane wrote:
>> If you want something cheap, you could use the same technique the
>> planner uses nowadays: take RelationGetNumberOfBlocks() (which is
>> guaranteed accurate) and multiply by reltuples/relpages.
> Yes - this would be an excellent approximation for my needs! The
> solution that Dawid Kuroczko suggested (just call "explain select *
> on ..." and parse the result) would be equivalent these days, right?
Close enough (the planner actually does some additional heuristic
stuff to avoid going crazy on corner cases).
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, swampler@noao.edu
Subject: Re: Make COUNT(*) Faster?
In-Reply-To: <23283.1120839143@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox