Re: Proposal for UPDATE: do not insert new tuple on heap if update does not change data

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gasper Zejn <zelo(dot)zejn(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal for UPDATE: do not insert new tuple on heap if update does not change data
Date: 2016-01-20 15:34:11
Message-ID: 1368.1453304051@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gasper Zejn <zelo(dot)zejn(at)gmail(dot)com> writes:
> I was wondering if PostgreSQL adds new tuple if data is not changed
> when using UPDATE. It turns out it does add them and I think it might
> be beneficial not to add a new tuple in this case, since it causes a
> great deal of maintenance: updating indexes, vacuuming table and
> index, also heap fragmentation.

This has been discussed in the past, and the conclusion was that expending
cycles on every UPDATE to check for this case would be a net loss. How
many real applications do no-op updates often enough that it's worth
optimizing for?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-01-20 15:37:01 Re: checkpointer continuous flushing
Previous Message Vladimir Sitnikov 2016-01-20 15:23:58 Re: Set search_path + server-prepared statements = cached plan must not change result type