From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | "Joshua J(dot) Kugler" <joshua(at)eeinternet(dot)com> |
Subject: | Re: Other queries locked out during long insert |
Date: | 2008-12-17 10:58:11 |
Message-ID: | 200812171258.11586.peter_e@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2008-12-17 11:26:00 | Re: A bit confused about Postgres Plus |
Previous Message | Martijn van Oosterhout | 2008-12-17 10:53:54 | Re: Other queries locked out during long insert |