Re: Seqscan in MAX(index_column) - Mailing list pgsql-hackers

From Neil Conway
Subject Re: Seqscan in MAX(index_column)
Date
Msg-id 1062728210.360.14.camel@tokyo
Whole thread Raw
In response to Re: Seqscan in MAX(index_column)  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Seqscan in MAX(index_column)  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Thu, 2003-09-04 at 22:02, Bruce Momjian wrote:
> My idea is that if a transaction doing a COUNT(*) would first look to
> see if there already was a visible cached value, and if not, it would do
> the COUNT(*) and insert into the cache table.  Any INSERT/DELETE would
> remove the value from the cache.  As I see it, the commit of the
> INSERT/DELETE transaction would then auto-invalidate the cache at the
> exact time the transaction commits.  This would allow MVCC visibility of
> the counts.

But this means that some of the time (indeed, *much* of the time),
COUNT(*) would require a seqscan of the entire table. Since at many
sites that will take an enormous amount of time (and disk I/O), that
makes this solution infeasible IMHO.

In general, I don't think this is worth doing.

-Neil




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Seqscan in MAX(index_column)
Next
From: Bruce Momjian
Date:
Subject: Re: Seqscan in MAX(index_column)