Move pgstat_report_tabstat() call so that stats are not reported to the
authorTom Lane <[email protected]>
Sat, 20 Nov 2004 00:48:58 +0000 (00:48 +0000)
committerTom Lane <[email protected]>
Sat, 20 Nov 2004 00:48:58 +0000 (00:48 +0000)
collector until the transaction commits.  Per recent discussion, this
should avoid confusing autovacuum when an updating transaction runs for
a long time.

src/backend/tcop/postgres.c

index 09a71a74b1616ac48deed55f47828e1b21d6ed2b..f2cd765ff656bcfe0606f325b6f3700894285f7a 100644 (file)
@@ -2904,12 +2904,11 @@ PostgresMain(int argc, char *argv[], const char *username)
                 * This is also a good time to send collected statistics to the
                 * collector, and to update the PS stats display.  We avoid doing
                 * those every time through the message loop because it'd slow
-                * down processing of batched messages.
+                * down processing of batched messages, and because we don't want
+                * to report uncommitted updates (that confuses autovacuum).
                 */
                if (send_rfq)
                {
-                       pgstat_report_tabstat();
-
                        if (IsTransactionOrTransactionBlock())
                        {
                                set_ps_display("idle in transaction");
@@ -2917,6 +2916,8 @@ PostgresMain(int argc, char *argv[], const char *username)
                        }
                        else
                        {
+                               pgstat_report_tabstat();
+
                                set_ps_display("idle");
                                pgstat_report_activity("<IDLE>");
                        }