"Stephen Denne" <Stephen.Denne@datamail.co.nz> writes:
> Tom Lane wrote
>> Umm ... AFAICS there is no need for an UPDATE to touch the count table
>> at all. You'd only need ON INSERT and ON DELETE triggers.
> I'm not referring to updates of my base table... the single row inserted was referring to the delta row...
> I'm trying to group together a large number of +1 or -1 deltas into a single delta per transaction.
Oh. You can't realistically do that from the level of individual ON
INSERT/DELETE triggers --- as you've found out, you end up with about
the same number of dead rows anyway. Collapsing a transaction's changes
into a single row would require keeping some intra-transaction state,
which is do-able at the C-code level but not from plpgsql.
regards, tom lane