Re: How to isolate the result of SELECT's?

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Andre Lopes <lopes80andre(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to isolate the result of SELECT's?
Date: 2012-03-19 00:21:26
Message-ID: 4F667C06.2020400@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/18/2012 04:33 PM, Andre Lopes wrote:
> Hi,
>
> I need to do an operation that I will use some SELECT's and get the
> results, but I want to have sure that those tables have not been
> changed with INSERT's or UPDATES during the operation.
>
> Example:
>
> BEGIN OPERATION
> Select field from table1;
> ...
> Select other_field from table2;
> ...
> END OPERATION
>
> How can I lock these tables to assure that the tables are not getting
> INSERTS's or UPDATE's during the operation?

Rather than replicate the docs in a post, I suggest you take a look at:

http://www.postgresql.org/docs/9.1/interactive/mvcc.html

It explains the various options you have very well.

>
> Best Regards,
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug Gorley 2012-03-19 01:22:03 Re: Zero-length character breaking query?
Previous Message Michael Nolan 2012-03-19 00:00:05 Re: How to isolate the result of SELECT's?