Oops! [EMAIL PROTECTED] (Gaetano Mendola) was seen spray-painting on a wall:
> Doug McNaught wrote:
>> Randolf Richardson <[EMAIL PROTECTED]> 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.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to