From: | Harald Fuchs <hf0614x(at)protecting(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Make COUNT(*) Faster? |
Date: | 2005-07-10 12:19:56 |
Message-ID: | puirziluoj.fsf@srv.protecting.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
In article <758d5e7f05070808305c049aae(at)mail(dot)gmail(dot)com>,
Dawid Kuroczko <qnex42(at)gmail(dot)com> writes:
> Use
> EXPLAIN SELECT * FROM yourcountedtable;
> Planner seems to track estimated statistics on-the-fly. :)
> You can even wrap EXPLAIN SELECT in a pgsql function if you
> need it.
Do you know how to do that? A function "approx_count(tablename)"
would be really handy, but
FOR row IN EXECUTE 'EXPLAIN SELECT * FROM ' || tbl LOOP
fails with the following message:
ERROR: cannot open non-SELECT query as cursor
> PS: And be aware that these are 'statistics'. And the statement that there
> are lies, big lies and statistics is sometimes true even for PostgreSQL. ;-)
Does this mean that PostgreSQL believes only in statistics it has
faked itself? ;-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-07-10 16:10:25 | Re: Make COUNT(*) Faster? |
Previous Message | Richard Hayward | 2005-07-10 10:52:10 | function parameters : bug? |