| От | Tom Lane |
|---|---|
| Тема | Re: DELETE, INSERT vs SELECT, UPDATE || INSERT |
| Дата | |
| Msg-id | 19921.1135351800@sss.pgh.pa.us обсуждение |
| Ответ на | DELETE, INSERT vs SELECT, UPDATE || INSERT (Anton Maksimenkov <engineer@hlebprom.ru>) |
| Список | pgsql-performance |
Anton Maksimenkov <engineer@hlebprom.ru> writes: > Second idea was to try to SELECT (user, cookie) pair and then UPDATE > it if it exists or INSERT if not. I has thought that if UPDATE will > rewrite same place in file with new count it may lead to more compact > table (file not grow and information about actual rows in file will > not changed). You're wasting your time, because Postgres doesn't work that way. UPDATE is really indistinguishable from DELETE+INSERT, and there will always be a dead row afterwards, because under MVCC rules both versions of the row have to be left in the table for some time after your transaction commits. See http://www.postgresql.org/docs/8.1/static/mvcc.html regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера