Transactions, stats and analyze (oh-my)

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Transactions, stats and analyze (oh-my)
Date: 2016-02-16 21:26:28
Message-ID: CAEfWYyw30KVzorNLrBSg+oMwyRsyK8vsM+xQ5japEGbA9uNv1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

We have certain processes that import data then process and distribute the
data. Since the processing looks primarily, but not exclusively, at the new
records an ANALYZE prior to processing yields better plans. Although the
table changes will trigger autovacuum to analyze the table this happens too
late to be of use for the subsequent processing so we run an explicit
analyze (which, when it collides with autovacuum, triggers a warning in the
logs).

I would like to roll a number of steps into a transaction. What happens to
the stats data generated by ANALYZE if the transaction is rolled back?

This message says the stats are reverted:
http://postgresql.nabble.com/Analyze-during-a-transaction-td5775069.html

This implies they are not:
http://www.postgresql.org/message-id/E1XjbTw-0002f9-Ri@gemulon.postgresql.org

Cheers,
Steve

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-02-16 21:32:53 Re: Transactions, stats and analyze (oh-my)
Previous Message Jeff Janes 2016-02-16 19:15:42 Re: PosgreSQL Security Architecture