Re: Accelerating aggregates - Mailing list pgsql-hackers

From Steve Atkins
Subject Re: Accelerating aggregates
Date
Msg-id 20040611152604.GA14405@gp.word-to-the-wise.com
Whole thread Raw
In response to Re: Accelerating aggregates  (Richard Huxton <dev@archonet.com>)
Responses Re: Accelerating aggregates
List pgsql-hackers
On Fri, Jun 11, 2004 at 09:27:07AM +0100, Richard Huxton wrote:

> >If the transaction is rolled back, the local state variable is
> >thrown away. If the transaction is commited and the local state
> >variable has been invalidated then the global state variable is
> >invalidated, otherwise the global state variable is updated using
> >a a state merge function, specific to the aggregate.
> 
> Isn't this going to have visibility issues wrt other backends? How do I 
> know what transactions have updated the global and what haven't and 
> which I should currently be seeing?

The global is only updated at transaction commit.

So, if you take a local snapshot of the global at the beginning of
your transaction then the visible changes at any point are those from
transactions that commited before your transaction started. That's
well-defined, at least, and appears to be pretty much the same as the
standard read commited isolation level.

> I'm not sure that there is a solution simpler than the "insert +1/-1 
> into summary table" that gets discussed.

That's fairly slow and painful.

Cheers, Steve


pgsql-hackers by date:

Previous
From: pgsql@mohawksoft.com
Date:
Subject: Re: Accelerating aggregates
Next
From: pgsql@mohawksoft.com
Date:
Subject: msession for PostgreSQL?