On 2016-05-24 13:04:09 -0500, Kevin Grittner wrote: > On Tue, May 24, 2016 at 12:00 PM, Andres Freund <and...@anarazel.de> wrote: > > > Analyze IIRC acquires a new snapshot when getting sample rows, > > I could not find anything like that, and a case-insensitive search > of analyze.c finds no occurrences of "snap". Can you remember > where you think you saw something that would cause the ANALYZE > command in my test to use a snapshot other than the one from the > REPEATABLE READ transaction in which it was run?
It's outside of analyze.c: autovacuum_do_vac_analyze() -> vacuum() -> if (options & VACOPT_VACUUM) use_own_xacts = true; else { Assert(options & VACOPT_ANALYZE); if (IsAutoVacuumWorkerProcess()) use_own_xacts = true; ... if (options & VACOPT_ANALYZE) { /* * If using separate xacts, start one for analyze. Otherwise, * we can use the outer transaction. */ if (use_own_xacts) { StartTransactionCommand(); /* functions in indexes may want a snapshot set */ PushActiveSnapshot(GetTransactionSnapshot()); } analyze_rel(relid, relation, options, params, va_cols, in_outer_xact, vac_strategy); if (use_own_xacts) { PopActiveSnapshot(); CommitTransactionCommand(); } } Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers