Re: Optional skipping of unchanged relations during ANALYZE?

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>
Cc: VASUKI M <vasukianand0119(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org>
Subject: Re: Optional skipping of unchanged relations during ANALYZE?
Date: 2026-02-20 11:52:53
Message-ID: c84ac92f-cf37-4398-a0f3-719274cb8c90@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2/19/26 21:23, Sami Imseih wrote:
> 3/
>
> + elog(DEBUG1,
> + "ANALYZE (MISSING_STATS_ONLY):
> skipping relation \"%s\"",
> + RelationGetRelationName(onerel));
>
> I think logging should be at info level, and we should only log when
> skipping a relation
>
>
> Also, I think it's better to use ereport like is being done for the other
> ANALYZE logging, i.e.
>
> ```
> appendStringInfo(&buf,
> _("WAL usage:
> %" PRId64 " records, %" PRId64 " full page images, %" PRIu64 " bytes,
> %" PRIu64 " full page image bytes, %" PRId64 " buffers full\n"),
> walusage.wal_records,
> walusage.wal_fpi,
> walusage.wal_bytes,
> walusage.wal_fpi_bytes,
>
> walusage.wal_buffers_full);
> appendStringInfo(&buf, _("system usage: %s"),
> pg_rusage_show(&ru0));
>
> ereport(verbose ? INFO : LOG,
> (errmsg_internal("%s", buf.data)));
> ```

+1

I agree that in VERBOSE mode we should display a message when the
relation is skipped. I suggest something along the lines of:

INFO:    Skipping analyzing "database.namespace.relation"

This would be consistent with the style already used in
do_analyze_rel(). Since this is executed ANALYZE, and no statistics are
actually collected , I don't think we need to display any additional
details beyond this single line.

--
Best regards.
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-02-20 12:33:16 Re: ecdh support causes unnecessary roundtrips
Previous Message Amit Kapila 2026-02-20 11:34:52 Re: Patch for migration of the pg_commit_ts directory