Re: Performance question

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Re: Performance question
Дата
Msg-id 3F027B36.5050009@mega-bucks.co.jp
обсуждение исходный текст
Ответ на Performance question  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Ответы Re: Performance question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
>
> That doesn't really buy anything in safety terms: if two backends
> execute this sort of command concurrently, it's perfectly likely
> that both sub-SELECTS will find no row matching 'v1', and so they'll
> both try the INSERT anyway.

I wasn't looking for safety so much as avoiding the insert if possible.
I've just finished a long thread about this and the consensus was that
this query would be:

1- the insert would always happen if there was no record with the same
primary key
2- is concurrency safe. Even if this query is executed by multiple
backends at the same time one will always succeed.

The reason I had asked for a query that could check before insert was to
reduce the number of log errors the phpOpenTracker tool generates from
trying to insert duplicate records into a table.

The above would reduce (but not eliminate) the number attempts to insert
duplicates and as such reduce the number of log error entries.

At least that's what I am hoping for ...

Jean-Christian Imbeault


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Performance question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Performance question