Re: using index to speedup add not null constraints to a table
| От | Álvaro Herrera |
|---|---|
| Тема | Re: using index to speedup add not null constraints to a table |
| Дата | |
| Msg-id | 202601140902.x7lh6iq42pwq@alvherre.pgsql обсуждение исходный текст |
| Ответ на | Re: using index to speedup add not null constraints to a table (Álvaro Herrera <alvherre@kurilemu.de>) |
| Ответы |
Re: using index to speedup add not null constraints to a table
|
| Список | pgsql-hackers |
On 2026-Jan-13, Álvaro Herrera wrote: > However, if we do this, then I think computing notnull_attrs is > pointless. So we should only change the order: do this new check > first, and if we find that any new not-null column is on a generated > column, then we compute both notnull_virtual_attrs and notnull_attrs. > No? Oh, another thing we should do is have a first pass that verifies whether all columns have an appropriate index, without scanning any of them; only if we verify that they all have one (and no generated column is involved) then we start scanning the indexes. Otherwise we waste time scanning one index and verify that it contains no null values, only to realize that the next column does not have an appropriate index to use, and thus we must scan the table. Then the first index scan is wasted work. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom." (Isaac Asimov)
В списке pgsql-hackers по дате отправления: