X-Original-To: pgsql-general@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3879F475EBC for ; Fri, 28 Feb 2003 11:41:18 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 66494-03 for ; Fri, 28 Feb 2003 11:41:07 -0500 (EST) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by postgresql.org (Postfix) with ESMTP id 537E04753A1 for ; Fri, 28 Feb 2003 10:28:37 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 18omRE-0007PM-0U; Fri, 28 Feb 2003 15:28:40 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 5D93817B0A; Fri, 28 Feb 2003 15:28:39 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id B896717A3E; Fri, 28 Feb 2003 15:28:38 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Jean-Christian Imbeault , PostgreSQL-general Subject: Re: Locking rows Date: Fri, 28 Feb 2003 15:27:40 +0000 User-Agent: KMail/1.4.3 References: <3E5F396F.4090507@mega-bucks.co.jp> In-Reply-To: <3E5F396F.4090507@mega-bucks.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200302281527.40316.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/1698 X-Sequence-Number: 38452 On Friday 28 Feb 2003 10:26 am, Jean-Christian Imbeault 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. > > I was thinking that a way around this would be to lock the rows that are > used to generate the print file. However I am not quite sure how to best > go about this. > > Is locking the rows the best (or simplest) solution? See the chapter "Concurrency Control" in the User Guide. Sounds like you wa= nt=20 to set transaction level to serializable - no explicit locking required. This means that within your report-building transaction you don't see any= =20 changes to the database (unless you do any within the transaction itself). HTH --=20 Richard Huxton