Re: Autoanalyze and OldestXmin - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Autoanalyze and OldestXmin
Date
Msg-id 14809.1307553307@sss.pgh.pa.us
Whole thread Raw
In response to Re: Autoanalyze and OldestXmin  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Responses Re: Autoanalyze and OldestXmin
List pgsql-hackers
Pavan Deolasee <pavan.deolasee@gmail.com> writes:
> I first thought that analyze and vacuum can not run concurrently on the same
> table since they take a conflicting lock on the table. So even if we ignore
> the analyze process while calculating the OldestXmin for vacuum, we should
> be fine since we know they are working on different tables. But I see
> analyze also acquires sample rows from the inherited tables with a
> non-conflicting lock. I probably do not understand the analyze code well,
> but is that the reason why we can't ignore analyze snapshot while
> determining OldestXmin for vacuum ?

The reason why we can't ignore that snapshot is that it's being set for
the use of user-defined functions, which might do practically anything.
They definitely could access tables other than the one under analysis.
(I believe that PostGIS does such things, for example --- it wants to
look at its auxiliary tables for metadata.)

Also keep in mind that we allow ANALYZE to be run inside a transaction
block, which might contain other operations sharing the same snapshot.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Marti Raudsepp
Date:
Subject: [PATCH] Allow star syntax in GROUP BY, as a shorthand for all table columns
Next
From: Simon Riggs
Date:
Subject: Re: reducing the overhead of frequent table locks - now, with WIP patch