Commit 86dc90056 - Rework planning and execution of UPDATE and DELETE
От | Rushabh Lathia |
---|---|
Тема | Commit 86dc90056 - Rework planning and execution of UPDATE and DELETE |
Дата | |
Msg-id | CAGPqQf02w895YKz2a2qpfmgAp8PaGe=oRAJWMEYeoZzPh9shgA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Commit 86dc90056 - Rework planning and execution of UPDATE and DELETE
Re: Commit 86dc90056 - Rework planning and execution of UPDATE and DELETE |
Список | pgsql-hackers |
Hi.
With the commit mentioned in the $subject, I am seeing the
change in behaviour with the varlena header size. Please
consider the below test:
postgres@83795=#CREATE TABLE test_storage_char(d char(20));
CREATE TABLE
postgres@83795=#INSERT INTO test_storage_char SELECT REPEAT('e', 20);
INSERT 0 1
postgres@83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
eeeeeeeeeeeeeeeeeeee | 21
(1 row)
postgres@83795=#ALTER TABLE test_storage_char ALTER COLUMN d SET STORAGE PLAIN;
ALTER TABLE
postgres@83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
eeeeeeeeeeeeeeeeeeee | 21
(1 row)
postgres@83795=#UPDATE test_storage_char SET d='ab' WHERE d LIKE '%e%';
UPDATE 1
postgres@83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
ab | 24
(1 row)
After changing the STORAGE for the column and UPDATE, pg_column_size
CREATE TABLE
postgres@83795=#INSERT INTO test_storage_char SELECT REPEAT('e', 20);
INSERT 0 1
postgres@83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
eeeeeeeeeeeeeeeeeeee | 21
(1 row)
postgres@83795=#ALTER TABLE test_storage_char ALTER COLUMN d SET STORAGE PLAIN;
ALTER TABLE
postgres@83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
eeeeeeeeeeeeeeeeeeee | 21
(1 row)
postgres@83795=#UPDATE test_storage_char SET d='ab' WHERE d LIKE '%e%';
UPDATE 1
postgres@83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
ab | 24
(1 row)
After changing the STORAGE for the column and UPDATE, pg_column_size
now returns the size as 24.
BEFORE Commit 86dc90056:
postgres@129158=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
ab | 21
(1 row)
d | pg_column_size
----------------------+----------------
ab | 21
(1 row)
I am not sure whether this change is expected? Or missing something
in the toasting the attribute?
Thanks,
Rushabh Lathia
В списке pgsql-hackers по дате отправления: