Re: update with no changes

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: update with no changes
Date: 2021-11-20 15:19:08
Message-ID: e5bdd1f7-5cd3-0408-eb78-da67106adbe6@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 11/20/21 10:03, Marcos Pegoraro wrote:
>
> suppress_redundant_updates_trigger was created precisely because it's
> not always easy to create application code in such a way that it
> generates no redundant updates. However, there is a cost to using it,
> and the break even point can be surprisingly high. It should therefore
> be used with caution, and after appropriate benchmarks.
>
> well, there is a cost of not using it too. If lots of things needs to
> be done when a record is stored, and if it doesn´t needed to be
> stored, all these things will not be done.  So, what are pros of
> changing a record which did not changed any value and what are cons of
> it ? So, I understood the way it works and yes, my point of view is
> that this trigger is really needed, for me, obviously.

If you need it then use it. It's been built into postgres since release
8.4. Just be aware that if you use it there is a cost incurred for every
record updated whether or not the record is redundant. If only 12% of
your updates are redundant I suspect it will be a net loss for you, but
as I said above you should benchmark it.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Todd Hubers 2021-11-20 16:11:03 Feature Proposal: Connection Pool Optimization - Change the Connection User
Previous Message Marcos Pegoraro 2021-11-20 15:03:26 Re: update with no changes