Re: Optional skipping of unchanged relations during ANALYZE? - Mailing list pgsql-hackers

From Ilia Evdokimov
Subject Re: Optional skipping of unchanged relations during ANALYZE?
Date
Msg-id 0ab28b49-29ca-4b71-82b0-dd45c9408f5f@tantorlabs.com
Whole thread Raw
In response to Re: Optional skipping of unchanged relations during ANALYZE?  (VASUKI M <vasukianand0119@gmail.com>)
Responses Re: Optional skipping of unchanged relations during ANALYZE?
List pgsql-hackers

On 21.01.2026 12:56, VASUKI M wrote:

On Wed, Jan 21, 2026 at 3:21 PM Christoph Berg <myon@debian.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/

pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Flush some statistics within running transactions
Next
From: John Naylor
Date:
Subject: Re: Proposal for enabling auto-vectorization for checksum calculations