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: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, Christoph Berg <myon(at)debian(dot)org>
Subject: Re: Optional skipping of unchanged relations during ANALYZE?
Date: 2026-01-21 10:49:18
Message-ID: 0ab28b49-29ca-4b71-82b0-dd45c9408f5f@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.01.2026 12:56, VASUKI M wrote:

> On Wed, Jan 21, 2026 at 3:21 PM Christoph Berg <myon(at)debian(dot)org> wrote:
>
> SMART is also a terribly non-descriptive name. How about CHANGED_ONLY?
>
>
>  Yeah i agree,as of now i am focusing on concept workflow will change
> name in next versions of patch.
>
> Regards,
> Vasuki M
> C-DAC,Chennai.

So do I

It seems to me that the condition for relations that have never had
statistics collected might be incorrect. If I'm reading this correctly,
shouldn't this be checking 'tabstat->mod_since_analyze > 0' instead of
'tabstat->mod_since_analyze == 0'? I tested it on simple query:

CREATE TABLE t (i INT, j INT);
INSERT INTO t SELECT i/10, i/100 FROM generate_series(1, 1000000) i;
ANALYZE (SMART) t;
SELECT COUNT(*) FROM pg_stats WHERE tablename = 't';
 count
-------
     0
(1 row)

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-01-21 11:13:02 Re: Proposal for enabling auto-vectorization for checksum calculations
Previous Message Bertrand Drouvot 2026-01-21 10:34:09 Re: Flush some statistics within running transactions