Re: Locking rows
| От | Manfred Koizar |
|---|---|
| Тема | Re: Locking rows |
| Дата | |
| Msg-id | a06v5voi0jtqin3sl6nq5ioiuinelrv4d9@4ax.com обсуждение исходный текст |
| Ответ на | Locking rows (Jean-Christian Imbeault <jc@mega-bucks.co.jp>) |
| Список | pgsql-general |
On Fri, 28 Feb 2003 19:26:55 +0900, Jean-Christian Imbeault
<jc@mega-bucks.co.jp> wrote:
>I have written an application that prints out data from a database. One
>problem I am encountering is in the time it takes to generate the print
>file the data may have changed.
> [...]
>Is locking the rows the best (or simplest) solution?
The simplest (and IMHO best) solution is:
BEGIN;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT <this> ...
SELECT <that> ...
SELECT <whatever> ...
COMMIT;
If your entire report is generated from the result of a single SELECT,
you don't even need that BEGIN/SET TRANSACTION/COMMIT stuff.
Servus
Manfred
В списке pgsql-general по дате отправления: