Re: CREATE INDEX vs. TOAST table stats - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: CREATE INDEX vs. TOAST table stats
Date
Msg-id CAA5RZ0v0xgNOKNaN0AJwZm9c_rn9s=KSaA2h+Nq69DPXCxkgig@mail.gmail.com
Whole thread
Responses Re: CREATE INDEX vs. TOAST table stats
List pgsql-hackers
Hi,

I agree on removing RELKIND_TOASTVALUE. A toast table has no restorable stats,
so we should not attempt to preserve the stats here. Also, main
relation and toast
drifting in stats already happens. We are not introducing any issue
here, AFAICT.

>      if (rel->rd_rel->relkind == RELKIND_RELATION ||
> -        rel->rd_rel->relkind == RELKIND_TOASTVALUE ||
>          rel->rd_rel->relkind == RELKIND_MATVIEW)

One thing is CREATE INDEX, mentioned in the subject, never calls
index_update_stats()
on the toast relation, so the toast stats are not updated by it. This
will only be called when
the toast's own index is rebuilt, i.e. REINDEX, VACUUM FULL, CLUSTER, REPACK.

+1 on backpatching to v18.

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Crash issue in PG18.5 regression
Next
From: Alexandre Felipe
Date:
Subject: Re: [PATCH] bufmgr: tighten LWLock:BufferMapping on InvalidateBuffer