Re: Locking - Mailing list pgsql-general

From Tom Lane
Subject Re: Locking
Date
Msg-id 25481.982602722@sss.pgh.pa.us
Whole thread Raw
In response to Locking  (Simon Attwell <attwell@binc.net>)
List pgsql-general
Simon Attwell <attwell@binc.net> writes:
> How does postgresql deal with locking when one has a large select
> query running on a > 700,000 row table, when there are inserts pending
> for that table.

> I have an application that does a _lot_ of inserts, and a frontend that
> makes large long laborious select queries on the same tables.

In Postgres, you don't lock, you just do the operations.  The SELECT
query won't see the results of (nor be blocked by) updating transactions
that start after it does.  If you need consistency across multiple
SELECTs then wrap them all in a BEGIN/END block.  See
http://www.postgresql.org/devel-corner/docs/postgres/mvcc.html
for more detail.

> MySQL has the INSERT DELAYED which allows batch processing of inserts and
> allows clients to receive and instant "OK" when doing inserts.

We think our scheme is a great deal better ;-)

            regards, tom lane

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Locking
Next
From: Peter Eisentraut
Date:
Subject: Re: Re: Postgres slowdown on large table joins