On Mon, 2024-03-04 at 10:16 +0530, veem v wrote:
> So the partitioned table stats is nothing but the rolledover stats of all the partitions.
> As you mentioned, autoanalyze only works for child partitions but not the partition tables,
> so does it mean we have to schedule some jobs manually(through some scheduletr like pg_cron)
> to analyze these partitioned tables at certain time intervals to keep those up to date for
> partitioned tables?
Something like that, yes.
> And won't that scan all the child partitions again to have the stats aggregated/rolled
> over from all the child partitions level to the table level?
Yes.
> Additionally if a query was working fine but suddenly takes a suboptimal plan because
> of missing stats , do we have any hash value column on any performance view associated
> with the queryid which we can refer to see past vs current plans difference and identify
> such issues quickly and fix it?
Not that I know of.
Yours,
Laurenz Albe