Re: feature proposal - triggers by semantics - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: feature proposal - triggers by semantics
Date
Msg-id CAB7nPqSf-tybcYEoukUPaY9SNaRnqMtxVucRDGEoLQVBOivFjQ@mail.gmail.com
Whole thread Raw
In response to feature proposal - triggers by semantics  (Darren Duncan <darren@darrenduncan.net>)
List pgsql-hackers
A row-level trigger for TRUNCATE does not really make sense, as it would mean that TRUNCATE needs to scan each tuple of
thetable it needs to interact with to fire its trigger, so it would more or less achieve the same performance as a
plain"DELETE FROM table;".<br /><br />TRUNCATE is performant because it only removes the tuples, and does not care
aboutscanning. I am also not sure it is meant for scanning (btw there are discussions about TRUNCATE these days so I
mightbe missing something).<br />So, what you are looking for can be simply solved with row-level triggers on DELETE,
sowhy not using that and avoid reinventing the wheel?<br />-- <br />Michael Paquier<br /><a
href="http://michael.otacoo.com"target="_blank">http://michael.otacoo.com</a><br /> 

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Doc patch making firm recommendation for setting the value of commit_delay
Next
From: Hannu Krosing
Date:
Subject: Re: feature proposal - triggers by semantics