Postgres Updating only changed columns against entire row

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's say I have a table like below

CREATE TABLE empl(
   id SERIAL PRIMARY KEY,
   name VARCHAR NOT NULL,
   address VARCHAR NOT NULL,
   status int NOT NULL,
   metadata varchar NOT NULL
);

and it has data like

(2, 'tuk', 'ind', 1, 'meta')
...
(200, 'tuka', 'eng', 2, 'meta2')
  1. update empl set status = 2 where (id = 2);
  2. update empl set status = 2, name='tuk', address='ind', metadata='meta' where (id = 2);

Can someone let me know if there are any advantages of doing #1 over #2 assuming there are no other indices or triggers on the table? Which is generally preferred?

Postgres Version - 10.17


[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux