| From: | solai v <solai(dot)cdac(at)gmail(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | Sami Imseih <samimseih(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Michael Paquier <michael(at)paquier(dot)xyz> |
| Subject: | Re: Preserve index stats during ALTER TABLE ... TYPE ... |
| Date: | 2026-06-16 05:52:26 |
| Message-ID: | CAF0whucLNV_aGw-1YBnJt7_SGOmRAXnb2SeiMSYDUenpxpv4aQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
I reviewed and tested the patch. I was able to reproduce the reported
behavior on an unpatched PostgreSQL build. After creating an index and
generating index usage statistics (idx_scan > 0), executing ALTER
TABLE ... ALTER COLUMN ... TYPE caused the index statistics to be
reset.
Example:
Before ALTER TABLE:
test_b_idx | 1
After ALTER TABLE:
test_b_idx | 0
I then applied the v2 patch, rebuilt PostgreSQL, and repeated the same
test. With the patch applied, the index statistics were preserved
across ALTER TABLE ... TYPE.
Example:
Before ALTER TABLE:
test_b_idx | 1
After ALTER TABLE:
test_b_idx | 1
I also verified that the index continued to be used through an Index
Scan before and after the ALTER operation.
Based on this testing, the patch appears to address the reported issue
and preserves the historical index usage statistics during ALTER TABLE
... TYPE.
Regards,
Solai
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2026-06-16 05:55:47 | Re: proposal - queryid can be used as filter for auto_explain |
| Previous Message | jian he | 2026-06-16 05:48:29 | IGNORE/RESPECT NULLS can be specified for (prokind == 'f'). |