Re: [HACKERS] Bug#48582: psql spends hours computing results it already knows (fwd)

From: Brian E Gallew <geek+(at)cmu(dot)edu>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Bug#48582: psql spends hours computing results it already knows (fwd)
Date: 1999-10-29 02:44:12
Message-ID: emacs-smtp-1573-14361-2556-312146@export.andrew.cmu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Then <tgl(at)sss(dot)pgh(dot)pa(dot)us> spoke up and said:
> The short answer to this is that maintaining a perfectly accurate tuple
> count on-the-fly would almost certainly cost more, totalled over all
> operations that modify a table, than we could ever hope to make back
> by short-circuiting "select count(*)" operations. (Consider
> concurrent transactions running in multiple backends, some of which
> may abort instead of committing, and others of which may already have
> committed but your transaction is not supposed to be able to see their
> effects...)

So, does the planner allow counting from a unique index (if one
exists)? In general, an index scan on a unique index should be faster
than a table scan. Of course, I'm sure someone already thought of this...

--
=====================================================================
| JAVA must have been developed in the wilds of West Virginia. |
| After all, why else would it support only single inheritance?? |
=====================================================================
| Finger geek(at)cmu(dot)edu for my public key. |
=====================================================================

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-10-29 03:57:59 Re: [HACKERS] Bug#48582: psql spends hours computing results it already knows (fwd)
Previous Message The Hermit Hacker 1999-10-29 01:45:37 Re: 6.5.3