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

Поиск
Список
Период
Сортировка
От Jayadevan M
Тема Re: How to isolate the result of SELECT's?
Дата
Msg-id OF76C71835.458B359E-ON652579C6.0013AAD3-652579C6.00141CE0@ibsplc.com
обсуждение исходный текст
Ответ на How to isolate the result of SELECT's?  (Andre Lopes <lopes80andre@gmail.com>)
Список pgsql-general
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?
>
If you set transaction isolation level to repeatable, the tables may undergo changes, but you will get repeatable reads. Explicitly locking the tables is another option.

http://www.postgresql.org/docs/current/static/explicit-locking.html
Regards,
Jayadevan





DISCLAIMER:


"The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."





В списке pgsql-general по дате отправления:

Предыдущее
От: Doug Gorley
Дата:
Сообщение: Re: Zero-length character breaking query?
Следующее
От: Aleksey Tsalolikhin
Дата:
Сообщение: nice'ing the postgres COPY backend process to make pg_dumps run more "softly"