Re: How to speed up Exclusive Locking

Поиск
Список
Период
Сортировка
От David Goodenough
Тема Re: How to speed up Exclusive Locking
Дата
Msg-id 200612051211.51280.david.goodenough@btconnect.com
обсуждение исходный текст
Ответ на Re: How to speed up Exclusive Locking  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
On Tuesday 05 December 2006 12:03, Richard Huxton wrote:
> David Goodenough wrote:
> > On Tuesday 05 December 2006 10:57, Bernd Helmle wrote:
> >> On Tue, 5 Dec 2006 10:18:21 +0000, David Goodenough
> >>
> >> <david.goodenough@btconnect.com> wrote:
> >>> The statements issued to lock each table is:-
> >>>  LOCK TABLE table IN EXCLUSIVE MODE; SELECT 1 FROM table;
> >>
> >> So why selecting '1' for each row after locking the relation before? I
> >> don't know HA-JDBC but this looks really useless. Remove the SELECT and
> >> use the LOCK TABLE command within the transaction which does the sync
> >> for you.
> >
> > I will give it a try.
>
> It could be that the HA-JDBC code expects some selected value back. In
> which case a simple "SELECT 1" should be fine. I have to agree with
> Bernd that selecting all rows and then throwing away the results strikes
> me as particularly a braindead behaviour from the library, presumably it
> makes some sort of sense for locking a limited number of rows.
HA-JDBC only ever locks a whole table.  As far as I can see it does not
use the ResultSet (and JDBC large ResultSets are never a good idea), so I
have asked the question on its forum why it is there.

Testing with psql a simple LOCK seems pleasantly fast.

David

В списке pgsql-general по дате отправления:

Предыдущее
От: "deepak pal"
Дата:
Сообщение: Time Stamp auto Field
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Time Stamp auto Field