Re: Repeatable Read Isolation in SQL running via background worker

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Repeatable Read Isolation in SQL running via background worker
Date: 2018-08-14 16:18:56
Message-ID: CA+TgmoYprsCtSHshZWk9pJQ+khM1SdZFmr9Hrq8hcU7uhZ+orQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 13, 2018 at 10:52 AM, Jeremy Finzel <finzelj(at)gmail(dot)com> wrote:
> On Thu, Aug 9, 2018 at 4:34 PM, Jeremy Finzel <finzelj(at)gmail(dot)com> wrote:
>> I am using worker_spi as a model to run a SQL statement inside a
>> background worker. From my browsing of the Postgres library, I believe that
>> if I want repeatable read isolation level, the proper way for me to attain
>> this is to add this line after StartTransactionCommand() in worker_spi_main:
>>
>> XactIsoLevel = XACT_REPEATABLE_READ;

It's usually a good idea to only change GUCs through the GUC machinery
i.e. use SetConfigOption().

Are you using StartTransactionCommand() and CommitTransactionCommand()
to manage transaction boundaries? If not, maybe you should.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-08-14 16:23:57 Re: Temporary tables prevent autovacuum, leading to XID wraparound
Previous Message Michael Paquier 2018-08-14 15:59:18 Re: Improve behavior of concurrent ANALYZE/VACUUM