Re: Implementing replace function

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Implementing replace function
Дата
Msg-id 20101102171404.GA2789@svana.org
обсуждение исходный текст
Ответ на Re: Implementing replace function  (Matthieu Huin <matthieu.huin@wallix.com>)
Список pgsql-general
On Tue, Nov 02, 2010 at 10:46:42AM +0100, Matthieu Huin wrote:
> Hello,
>
> If you expect your data to reach some kind of "critical size" at some
> point ( ie updates will be more likely than inserts at that point ), you
> can optimize your UPSERT code by trying to UPDATE before INSERTing.
> Otherwise trying to INSERT first should decrease the average UPSERT
> execution time in the long run, since you are less likely to hit the
> exception and do some extra work on the table.

You'd almost think of using some kind of branch prediction techniques.
You could track what happened the last two times and use that to
predict which would be better. There's always pathelogical cases, but
it could work well for normal workloads.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patriotism is when love of your own people comes first; nationalism,
> when hate for people other than your own comes first.
>                                       - Charles de Gaulle

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Feature request for this mail list
Следующее
От: hernan gonzalez
Дата:
Сообщение: pg_migrator segfault