Re: [HACKERS] []performance issues

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: [HACKERS] []performance issues
Дата
Msg-id 20020806174500.C29630@mail.libertyrms.com
обсуждение исходный текст
Ответ на Re: [HACKERS] []performance issues  (Rod Taylor <rbt@zort.ca>)
Список pgsql-general
On Fri, Aug 02, 2002 at 02:08:02PM -0400, Rod Taylor wrote:
>
> Of course, as suggested this is easily overcome by keeping your own c
> counter.
>
> begin;
> insert into bigtable values ();
> update into counttable set count=count+1;
> commit;
>
> Now you get all the fun concurrency issues -- but fetching the
> information will be quick.   What happens more, the counts, or the
> inserts :)

You could get around this with a trigger that just inserts 1 into one
table (call it counter_unposted), and then using an external process
to take those units, add them to the value in counter_posted, and
delete them from counter_unposted.  You'd always be a few minutes
behind, but you'd get a counter that's pretty close without too much
overhead.  Of course, this raises the obvious question: why use
count() at all?

A

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110


В списке pgsql-general по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: URGENT: Database keeps crashing - suspect damaged
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: concept question: PostgreSQL vs. Oracle database