Re: Make attstattarget nullable
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-12-23T12:56:29Z
Lists: pgsql-hackers
Attachments
- v2-0001-Make-attstattarget-nullable.patch (text/plain) patch v2-0001
- v2-0002-WIP-Generalize-handling-of-nullable-pg_attribute-.patch (text/plain) patch v2-0002
- v2-0003-WIP-Add-attstattarget-to-Form_pg_attribute_extra.patch (text/plain) patch v2-0003
Here is an updated patch rebased over 3e2e0d5ad7. The 0001 patch stands on its own, but I also tacked on two additional WIP patches that simplify some pg_attribute handling and make these kinds of refactorings simpler in the future. See description in the patches. On 05.12.23 13:52, Peter Eisentraut wrote: > In [0] it was discussed that we could make attstattarget a nullable > column, instead of always storing an explicit -1 default value for most > columns. This patch implements this. > > This changes the pg_attribute field attstattarget into a nullable field > in the variable-length part of the row. If no value is set by the user > for attstattarget, it is now null instead of previously -1. This saves > space in pg_attribute and tuple descriptors for most practical > scenarios. (ATTRIBUTE_FIXED_PART_SIZE is reduced from 108 to 104.) > Also, null is the semantically more correct value. > > The ANALYZE code internally continues to represent the default > statistics target by -1, so that that code can avoid having to deal with > null values. But that is now contained to ANALYZE code. The DDL code > deals with attstattarget possibly null. > > For system columns, the field is now always null but the effective value > 0 (don't analyze) is assumed. > > To set a column's statistics target to the default value, the new > command form ALTER TABLE ... SET STATISTICS DEFAULT can be used. (SET > STATISTICS -1 still works.) > > > [0]: > https://www.postgresql.org/message-id/flat/d07ffc2b-e0e8-77f7-38fb-be921dff71af%40enterprisedb.com
Commits
-
Initialize variables to placate compiler.
- 949300402bde 17.0 landed
-
Add attstattarget to FormExtraData_pg_attribute
- 6a004f1be87d 17.0 landed
-
Generalize handling of nullable pg_attribute columns in DDL
- d939cb2fd612 17.0 landed
-
Make stxstattarget nullable
- 012460ee93c3 17.0 landed
-
Make attstattarget nullable
- 4f622503d6de 17.0 landed