Re: for help!
От | Andrew Sullivan |
---|---|
Тема | Re: for help! |
Дата | |
Msg-id | 20030416155312.GF19999@libertyrms.info обсуждение исходный текст |
Ответ на | Re: for help! (Josh Berkus <josh@agliodbs.com>) |
Ответы |
Re: for help!
|
Список | pgsql-performance |
On Wed, Apr 16, 2003 at 08:48:36AM -0700, Josh Berkus wrote: > Scott, > > > Well, you can always use the trick of putting an on insert / delete > > trigger on the table that maintains a single row table with the current > > count. That way, whenever a row is added or removed, the count is > BTW, I tested this for a client. I found the performance penalty > on inserts and updates to be: [. . .] > Please note that the effective performance penalty on inserts and > updates was dramatically higher for large batches of updates than > for small ones. Presumably the problem was to do with contention? This is why I don't really like the "update one row" approach for this sort of thing. But you _could_ write a trigger which inserts into a "staging" table, and write a little daemon which only updates the count table with the data from the staging table. It's a mighty ugly hack, but it ought to work. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada <andrew@libertyrms.info> M2P 2A8 +1 416 646 3304 x110
В списке pgsql-performance по дате отправления: