| From: | Manfred Koizar <mkoi-pg(at)aon(dot)at> | 
|---|---|
| To: | Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp> | 
| Cc: | PostgreSQL-general <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Locking rows | 
| Date: | 2003-02-28 17:16:32 | 
| Message-ID: | a06v5voi0jtqin3sl6nq5ioiuinelrv4d9@4ax.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Fri, 28 Feb 2003 19:26:55 +0900, Jean-Christian Imbeault
<jc(at)mega-bucks(dot)co(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ed L. | 2003-02-28 18:20:27 | Re: 7.4? | 
| Previous Message | Jean-Christian Imbeault | 2003-02-28 16:49:33 | Re: Locking rows |