• Tom Lane's avatar
    Change ANALYZE to take ShareUpdateExclusiveLock not AccessShareLock on · da7540b9
    Tom Lane authored
    the table being analyzed.  This prevents two ANALYZEs from running
    concurrently on the same table and possibly suffering concurrent-update
    failures while trying to store their results into pg_statistic.  The
    downside is that a database-wide ANALYZE executed within a transaction
    block will hold ShareUpdateExclusiveLock on many tables simultaneously,
    which could lead to concurrency issues or even deadlock against another
    such ANALYZE.  However, this seems a corner case of less importance
    than getting unexpected errors from a foreground ANALYZE when autovacuum
    elects to analyze the same table concurrently.  Per discussion.
    da7540b9
mvcc.sgml 38.8 KB