On 04/08/2017 11:13 PM, Asim Praveen wrote:
> On Sat, Apr 8, 2017 at 4:05 AM, Heikki Linnakangas <
hlinna...@pivotal.io>
> wrote:
>>
>> SELECT pg_sleep(10) FROM tableA
>> UNION ALL
>> SELECT myfunction();
>>
>> where myfunction() runs a query:
>>
>> SELECT * FROM <table-being-vacuumed>
>>
>> If vacuum runs after acquiring the snapshot, but before myfunction()
> runs, you have a problem.
>
> I must admit that we didn't think about the UDF case. But the stale
> snapshot does not seem to be a problem. Note that PR 790 changes vacuum
> behavior to use local transactions on QEs. Any tuples in pg_aoseg touched
> by vacuum will be evaluated against QE local snapshot. QE acquires a new
> local snapshot upon receiving the dispatched statement. If vacuum
> committed before a snapshot is acquired by QE, changes made by vacuum will
> be visible through this snapshot.
Hmm. Do we have a different problem, then? If the QE backend reads
vacuum transaction committed, it will read the new segment. But the new