Re: Other queries locked out during long insert
От | Peter Eisentraut |
---|---|
Тема | Re: Other queries locked out during long insert |
Дата | |
Msg-id | 200812171258.11586.peter_e@gmx.net обсуждение исходный текст |
Ответ на | Other queries locked out during long insert ("Joshua J. Kugler" <joshua@eeinternet.com>) |
Ответы |
Re: Other queries locked out during long insert
|
Список | pgsql-general |
On Wednesday 17 December 2008 12:18:04 Joshua J. Kugler wrote: > Begin > Truncate table1, table2 > > for row in file1: > insert into table1 > sleep(0.001) # see note below > > for row in file2: > insert into table2 > sleep(0.001) # see note below > > Commit > During the time where the insert loops are running, I cannot do any > queries against table1 and table2. Because the TRUNCATE commands are taking out an exclusive lock on the tables. > My understanding of MVCC is that I should be able to query against those > tables while these insert loops are in their transaction. You get the MVCC behavior if you use DELETE instead of TRUNCATE. TRUNCATE is specifically designed for better speed and less concurrency. It's your choice.
В списке pgsql-general по дате отправления: