Re: Optional skipping of unchanged relations during ANALYZE?

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: VASUKI M <vasukianand0119(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, 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-03-04 11:21:38
Message-ID: b3fc5424-e993-4b3e-b9df-83f7f5f21e79@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Before posting patches, it would be very helpful to run at least 'make
check' and 'make check-world' on a build configured with
--enable-cassert and --enable-tap-tests, as this often helps to catch
issues early.

A few additional moments:

1. If we determine that statistics already exists, it is not enough to
only call vac_close_indexes(). We also need to make sure that everything
else is freed properly: memory contexts, restored privileges, etc.
Please take a look at the end of do_analyze_rel() for the full cleanup
sequence.

2. Static functions should be also have their declarations placed at the
top of the file, following the usual style.

3. The expression (params.options & VACOPT_MISSING_STATS_ONLY) appears
multiple times. It might be simpler to introduce a local variable such
as 'missing_stats_only' and use it instead.

4. The message about skipping analyzing for a relation should follow the
same logging pattern as the message about analyzing a relation, i.e.
using 'verbose ? INFO : LOG'. See the end of the function for reference.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Florents Tselai 2026-03-04 11:34:42 Re: doc: add note that wal_level=logical doesn't set up logical replication in itself
Previous Message Amit Kapila 2026-03-04 11:00:48 Re: Skipping schema changes in publication