Re: How to speed up Exclusive Locking - Mailing list pgsql-general

From Tom Lane
Subject Re: How to speed up Exclusive Locking
Date
Msg-id 5458.1165335396@sss.pgh.pa.us
Whole thread Raw
In response to How to speed up Exclusive Locking  (David Goodenough <david.goodenough@btconnect.com>)
List pgsql-general
David Goodenough <david.goodenough@btconnect.com> writes:
> The statements issued to lock each table is:-
>  LOCK TABLE table IN EXCLUSIVE MODE; SELECT 1 FROM table;
> (I am not quite sure why the SELECT 1 FROM table is there, it came with
> HA-JDBC as the code for the Postgresql dialect).

> I notice that this seems to take a time that is dependant on the size
> of the table, which seems odd - almost as though it is locking each row
> rather than the whole table at once.

No, but it's *reading* each row to execute the "SELECT 1 FROM table".

            regards, tom lane

pgsql-general by date:

Previous
From: Bob Pawley
Date:
Subject: Re: PG Admin
Next
From: "Schwenker, Stephen"
Date:
Subject: HELP: Urgent, Vacuum problem