From: Tomasz Ostrowski <tometzky+pg@ato.waw.pl>
To: pgsql-bugs@postgresql.org
Subject: Routine analyze of single column prevents standard autoanalyze from running at all
Date: Mon, 6 Jun 2016 16:25:29 +0200
Message-ID: <ef99c1bd-ff60-5f32-2733-c7b504eb960c@ato.waw.pl> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Hi.
I'm routinely bulk inserting data to a PostgreSQL table and then
analyzing a single column of the table, because it contains data which
significantly changes histogram of this column values - for example
something like adding rows with "todo=true" column, when all rows before
bulk insert have "todo=false".
This column has rather small "statistics" value, so analyze of it is
fairly fast, which is important as I'm doing it often and also in
parallel (and analyze blocks - only one can run at the time). The full
analyze of this large table would take a lot of time (20 times more
actually), and I can't perform it after each bulk insert.
But I've noticed that a standard automatic analyze, which should work in
background, never runs. I've noticed that this fast analyze of one
column resets pg_stat_user_tables(n_mod_since_analyze) counter.
I suppose that the decision to analyze the whole table is based on these
values from pg_stat_user_tables and autovacuum_analyze_threshold and
autovacuum_analyze_scale_factor settings. And in this case this highly
updated table never reaches these values.
I suppose this is a bug - an analyze, which does not analyze all
columns, should not reset pg_stat_user_tables(n_mod_since_analyze). What
do you think?
--
Tomasz "Tometzky" Ostrowski
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tometzky+pg@ato.waw.pl
Subject: Re: Routine analyze of single column prevents standard autoanalyze from running at all
In-Reply-To: <ef99c1bd-ff60-5f32-2733-c7b504eb960c@ato.waw.pl>
References: <ef99c1bd-ff60-5f32-2733-c7b504eb960c@ato.waw.pl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox