Re: count(*) performance improvement ideas
| От | Tom Lane | 
|---|---|
| Тема | Re: count(*) performance improvement ideas | 
| Дата | |
| Msg-id | 21266.1205897206@sss.pgh.pa.us обсуждение исходный текст  | 
		
| Ответ на | Re: count(*) performance improvement ideas ("Stephen Denne" <Stephen.Denne@datamail.co.nz>) | 
| Список | pgsql-hackers | 
"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
		
	В списке pgsql-hackers по дате отправления: