Updates: all or partial records

From: Paul M Foster <paulf(at)quillandmouse(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Updates: all or partial records
Date: 2010-01-25 06:13:46
Message-ID: 20100125061346.GU3304@quillandmouse.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scenario: You have to update a record. One or more fields are unchanged
from the original record being altered. So you have two options: 1)
Include those fields in your UPDATE statement, even though they are
unchanged; 2) Omit unchanged fields from the UPDATE statement.

My first inclination is to omit unchanged fields. However, I have the
idea that PG simply marks the existing record to be dropped, and
generates a whole new row by copying unspecified fields from the
original record.

My question is, which is more efficient? Performance-wise, does it
matter whether unchanged fields are included or omitted on UPDATE
statements?

Paul

--
Paul M. Foster

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hashimoto Yuya 2010-01-25 06:56:23 Re: 100% of CPU utilization postgres process
Previous Message Hashimoto Yuya 2010-01-25 05:26:18 Re: 100% of CPU utilization postgres process