Re: Best possible way to insert and get returned ids
В списке pgsql-performance по дате отправления:
| От | Robert Haas |
|---|---|
| Тема | Re: Best possible way to insert and get returned ids |
| Дата | |
| Msg-id | 603c8f070911250640u6cfdd734k1b9bfad6c086080@mail.gmail.com обсуждение |
| Ответ на | Best possible way to insert and get returned ids (Jason Dictos <jdictos@barracuda.com>) |
| Список | pgsql-performance |
On Mon, Nov 23, 2009 at 3:53 PM, Jason Dictos <jdictos@barracuda.com> wrote: > Is an INSERT command with a SELECT statement in the RETURNING * parameter > faster than say an INSERT and then a SELECT? Does the RETURNING * parameter > simply amount to a normal SELECT command on the added rows? We need to > basically insert a lot of rows as fast as possible, and get the ids that > were added. The number of rows we are inserting is dynamic and is not of > fixed length. With INSERT ... RETURNING, you only make one trip to the heap, so I would expect it to be faster. Plus, of course, it means you don't have to worry about writing a WHERE clause that can identify the row(s) you just added. It sounds like the right tool for your use case. ...Robert
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера