Re: SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5

From: Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>
To: Hans-Juergen Schoenig <postgres(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5
Date: 2009-05-11 08:29:46
Message-ID: BBC01F47-2E04-4699-AC65-43F85D86B38B@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

--
Greg

On 11 May 2009, at 11:18, Hans-Juergen Schoenig <postgres(at)cybertec(dot)at>
wrote:

> hello greg,
>
> the thing with statement_timeout is a little bit of an issue.
> you could do:
> SET statement_timeout TO ...;
> SELECT FOR UPDATE ...
> SET statement_timeout TO default;
>
> this practically means 3 commands.

I tend to think there should be protocol level support for options
like this but that would require buy-in from the interface writers.

>
> the killer argument, however, is that the lock might very well
> happen ways after the statement has started.

Sure. But Isn't the statement_timeout behaviour what an application
writer would actually want? Why would he care how long some sub-part
of the statement took? Isn't an application -you used the example of a
web app - really concerned with its response time?

>
> imagine something like that (theoretical example):
>
> SELECT ...
> FROM
> WHERE x > ( SELECT some_very_long_thing)
> FOR UPDATE ...;
>
> some operation could run for ages without ever taking a single,
> relevant lock here.
> so, you don't really get the same thing with statement_timeout.
>
> regards,
>
> hans
>
>
>
>
> Greg Stark wrote:
>> Can't you to this today with statement_timeout? Surely you do want
>> to rollback the whole transaction or at least the subtransaction if
>> you have error handling.
>>
>
>
>
>
> --
> Cybertec Schönig & Schönig GmbH
> Professional PostgreSQL Consulting, Support, Training
> Gröhrmühlgasse 26, A-2700 Wiener Neustadt
> Web: www.postgresql-support.de
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2009-05-11 09:15:32 Re: bytea vs. pg_dump
Previous Message Hans-Juergen Schoenig 2009-05-11 08:26:52 SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5