Subject: Re: Cannot turn track_counts on

From: Anton Shepelev <[email-masked]>
Date: Thu, 17 Apr 2025 17:05:34 +0300

Tom Lane to Anton Shepelev:

> > I have a Postgres sever with the 'track_counts' setting
> > stuck in 'off'.  [...]
>
> I am fairly certain that there is nothing in core Postgres
> that would do that.  PGC_S_OVERRIDE is used to lock down
> the values of certain variables that shouldn't be allowed
> to change, but track_counts surely isn't one of those.
> And a quick grep through the code finds nothing applying
> PGC_S_OVERRIDE to it.

Thanks for checking it, Tom.

> What extensions do you have installed?

Nothing much:

  db=# show shared_preload_libraries;
   shared_preload_libraries
  ---------------------------
   online_analyze, plantuner

  db=# \dx
                   List of installed extensions
    Name   | Version |   Schema   |         Description
  ---------+---------+------------+------------------------------
   plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments

---

From: Tom Lane <[email-masked]>
Date: Thu, 17 Apr 2025 10:23:18 -0400

>   db=# show shared_preload_libraries;

Never heard of either of those, but just from the names, they sound
like they might be things that would take it on themselves to fool
with your stats-collection settings.  I'd check their code for
something close to

	SetConfigOption("track_counts", ..., PGC_S_OVERRIDE);

			regards, tom lane

---

From: Adrian Klaver <[email-masked]>
Date: Thu, 17 Apr 2025 08:16:58 -0700

> 	SetConfigOption("track_counts", ..., PGC_S_OVERRIDE);

I found this:

https://github.com/postgrespro/plantuner/blob/master/plantuner.c

Could not see PGC_S_OVERRIDE in it.

For online_analyze the only code I could find is old:

https://github.com/postgrespro/pgwininstall/blob/master/patches/postgresql/9.6/online_analyze.patch

Again no PGC_S_OVERRIDE.

-- 
Adrian Klaver
[email-masked]

---

From: Adrian Klaver <[email-masked]>
Date: Thu, 17 Apr 2025 08:17:19 -0700

>    db=# show shared_preload_libraries;

Are you running PostgresPro?

Both those modules are associated with it:

https://postgrespro.com/docs/postgrespro/17/contrib.html

If you are you might want to talk to their tech support.