Re: *sigh* - Mailing list pgsql-hackers

From Christopher Browne
Subject Re: *sigh*
Date
Msg-id m3r7zqa42j.fsf@wolfe.cbbrowne.com
Whole thread Raw
In response to *sigh*  (Thomas Zehetbauer <thomasz@hostmaster.org>)
List pgsql-hackers
Oops! mendola@bigfoot.com (Gaetano Mendola) was seen spray-painting on a wall:
> Doug McNaught wrote:
>> Randolf Richardson <rr@8x.ca> writes:
>>
>>>        What about adding a "total number of rows" value to the
>>> internal header of each table which gets incremented/decremented
>>> after each row is INSERT/DELETE has been committed.  This way, a
>>> generic "count(*)" by itself could simply return this value without
>>> any delay at all.
>> Because different sessions have a (validly) different concept of what
>> that number should be, due to MVCC.
>
> The count(*) information can be revisioned too, am I wrong ? I'm able to
> create a trigger that store the count(*) information in a special table,
> why not implement the same in a way "builded in" ?

You could do this; the cost would be pretty high, as there would be an
extra table update done every time rows were inserted or deleted.
Doing it on _every_ table would be a heavy overhead that is not
worthwhile.

What might make sense would be to set up triggers to do this on those
large tables where you frequently need COUNT(*).
-- 
"cbbrowne","@","cbbrowne.com"
http://www.ntlug.org/~cbbrowne/lisp.html
As of next month, MACLISP "/" will be flushed in favor of "\".
Please update the WORLD.


pgsql-hackers by date:

Previous
From: Doug McNaught
Date:
Subject: Re: *sigh*
Next
From: Bruce Momjian
Date:
Subject: Re: [BUGS] 7.4: CHAR padding inconsistency