Commit 86dc90056 - Rework planning and execution of UPDATE and DELETE

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: Commit 86dc90056 - Rework planning and execution of UPDATE and DELETE
Date: 2021-04-19 13:00:06
Message-ID: CAGPqQf02w895YKz2a2qpfmgAp8PaGe=oRAJWMEYeoZzPh9shgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)83795=#CREATE TABLE test_storage_char(d char(20));
CREATE TABLE
postgres(at)83795=#INSERT INTO test_storage_char SELECT REPEAT('e', 20);
INSERT 0 1
postgres(at)83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
eeeeeeeeeeeeeeeeeeee | 21
(1 row)

postgres(at)83795=#ALTER TABLE test_storage_char ALTER COLUMN d SET STORAGE
PLAIN;
ALTER TABLE
postgres(at)83795=#SELECT d, pg_column_size(d) FROM test_storage_char;
d | pg_column_size
----------------------+----------------
eeeeeeeeeeeeeeeeeeee | 21
(1 row)

postgres(at)83795=#UPDATE test_storage_char SET d='ab' WHERE d LIKE '%e%';
UPDATE 1
postgres(at)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(at)129158=#SELECT d, pg_column_size(d) FROM test_storage_char;
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
www.EnterpriseDB.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-04-19 13:19:36 Re: [CLOBBER_CACHE]Server crashed with segfault 11 while executing clusterdb
Previous Message Amit Langote 2021-04-19 12:44:05 Re: Table refer leak in logical replication