Re: pgsql_fdw, FDW for PostgreSQL server

Albe Laurenz <laurenz.albe@wien.gv.at>

From: "Albe Laurenz" <laurenz.albe@wien.gv.at>
To: "Kevin Grittner *EXTERN*" <Kevin.Grittner@wicourts.gov>, "Shigeru Hanada *EXTERN*" <shigeru.hanada@gmail.com>
Cc: "Robert Haas" <robertmhaas@gmail.com>, "Hitoshi Harada" <umi.tanuki@gmail.com>, "Kohei KaiGai" <kaigai@kaigai.gr.jp>, "Etsuro Fujita" <fujita.etsuro@lab.ntt.co.jp>, "PostgreSQL-development" <pgsql-hackers@postgresql.org>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Martijn van Oosterhout" <kleptog@svana.org>
Date: 2012-02-20T15:51:17Z
Lists: pgsql-hackers
Kevin Grittner wrote:
> > If your query involves foreign scans on two foreign tables on the
> > same foreign server, these should always see the same snapshot,
> > because that's how it works with two scans in one query on local
> > tables.
> 
> That makes sense.

> > So I think it should be REPEATABLE READ in all cases -
> > SERIALIZABLE is not necessary as long as all you do is read.
> 
> That depends on whether you only want to see states of the database
> which are consistent with later states of the database and any
> invariants enforced by triggers or other software.  See this example
> of how a read-only transaction can see a bogus state at REPEATABLE
> READ or less strict transaction isolation:
> 
> http://wiki.postgresql.org/wiki/SSI#Read_Only_Transactions
> 
> Perhaps if the transaction using the pgsql_fdw is running at the
> SERIALIZABLE transaction isolation level, it should run the queries
> at the that level, otherwise at REPEATABLE READ.

I read the example carefully, and it seems to me that it is necessary
for the read-only transaction (T3) to be SERIALIZABLE so that
T1 is aborted and the state that T3 saw remains valid.

If I understand right, I agree with your correction.

Yours,
Laurenz Albe