Re: Insert vs Update

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Insert vs Update
Дата
Msg-id CAKFQuwaoeiAZUmhm0epdoGJqDa+fJVknMx7sXX8NxjF3pgzSxQ@mail.gmail.com
обсуждение исходный текст
Ответ на Insert vs Update  (Robert DiFalco <robert.difalco@gmail.com>)
Список pgsql-performance
On Wed, Jul 15, 2015 at 12:16 PM, Robert DiFalco <robert.difalco@gmail.com> wrote:
First off I apologize if this is question has been beaten to death. I've looked around for a simple answer and could not find one. 

Given a database that will not have it's PKEY or indices modified, is it generally faster to INSERT or UPDATE data. And if there is a performance difference is it substantial?

I have a situation where I can easily do one or the other to the same effect. For example, I have a journaling schema with a limited number of "states" for an "entry". Currently each state is it's own table so I just insert them as they occur. But I could easily have a single "entry" table where the row is updated with column information for states (after the entry's initial insertion). 

Not a big deal but since it's so easy for me to take either approach I was wondering if one was more efficient (for a large DB) than another. 


​There is HOT (heap only tuple?) optimization that can occur if only non-indexed data is altered.  I do not recall the specifics.

Dave
 

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

Предыдущее
От: Robert DiFalco
Дата:
Сообщение: Insert vs Update
Следующее
От: Michael Nolan
Дата:
Сообщение: Re: Insert vs Update