Re: performance: delete+insert versus update

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: performance: delete+insert versus update
Дата
Msg-id 1058.1238475369@sss.pgh.pa.us
обсуждение исходный текст
Ответ на performance: delete+insert versus update  (Lonni J Friedman <netllama@gmail.com>)
Список pgsql-novice
Lonni J Friedman <netllama@gmail.com> writes:
> I'm in the midst of a heated debate with a coworker over whether doing
> a delete + insert is more expensive than doing an update.  My belief
> is that an update will usually be less expensive.  Can anyone weigh
> in?

Well, in terms of changes hitting the disk, they're approximately
the same thing in Postgres (not so in many other DBs, though).  However,
the overhead of issuing two SQL commands instead of one means that the
update method should win.

If your coworker knows how to do a delete+insert with no more SQL
interpretation than an update, I'd like to see it ...

            regards, tom lane

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

Предыдущее
От: Lonni J Friedman
Дата:
Сообщение: performance: delete+insert versus update
Следующее
От: bijoy franco
Дата:
Сообщение: OperationalError while using postgresql through python