Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?
От
Dmitry Koterov
Тема
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?
Дата
Msg-id
d7df81620905280916t6975c1a1l83d512227987dae8@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Dmitry Koterov <dmitry@koterov.ru>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Sam Mason <sam@samason.me.uk>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Tom Lane <tgl@sss.pgh.pa.us>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Greg Stark <stark@enterprisedb.com>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Tom Lane <tgl@sss.pgh.pa.us>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Greg Stark <stark@enterprisedb.com>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Tom Lane <tgl@sss.pgh.pa.us>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Sam Mason <sam@samason.me.uk>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Greg Stark <greg.stark@enterprisedb.com>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Robert Haas <robertmhaas@gmail.com>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Robert Haas <robertmhaas@gmail.com>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Dmitry Koterov <dmitry@koterov.ru>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Tom Lane <tgl@sss.pgh.pa.us>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Dmitry Koterov <dmitry@koterov.ru>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Peter Eisentraut <peter_e@gmx.net>
Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx? Robert Haas <robertmhaas@gmail.com>
Dmitry Koterov <dmitry@koterov.ru> writes:You are wrong --- t_natts would be six here. In general the length of
> No, I meant that in case of the row (1, NULL, NULL, 2, 3, NULL):
> - the corresponding NULL bitmap is (100110...)
> - the corresponding tuple is (1, 2, 3)
> - t_natts=3 (if I am not wrong here)
the null bitmap in a tuple (if it has one at all) is always exactly
equal to its t_natts value.
And so, the real number of values in the tuple - (1, 2, 3) above - is equal to the number of 1-bits in NULL bitmap. And the size of NULL bitmap is held in t_natts. I meant that when I said "thanks to NULL bitmap, adding a new nullable column is cheap". :-) And, of course, thanks to t_natts (HeapTupleHeaderGetNatts macro) - too.
В списке pgsql-hackers по дате отправления