On 10/10/11 11:24, Mark Rotteveel wrote: > On Mon, 10 Oct 2011 09:11:40 +0200, Thomas Steinmaurer > <t...@iblogmanager.com> wrote: >>> I think that the Oracle WHEN-clause is simply syntactic sugar for >>> wrapping >>> the entire body in an IF-condition. I don't think there would be much >>> difference performance-wise. >> If a WHEN clause implies that the trigger gets fired anyway, then right, >> this wouldn't make a difference. ;-) > I don't know enough about the inner-workings of Oracle but something will > need to be executed and evaluated to make that WHEN decision, and I would > be surprised if it would have any serious difference in performance to do > that separately before the trigger or inside the actual trigger-code. Based > on that I would think that it is simply syntactic sugar and the actual > generated objectcode is simply the equivalent of having an IF inside the > trigger code, as it would reduce the number of code execution points (and > the work for Oracle in terms of code maintenance for a separate conditional > evaluation before triggers).
At the first glance it's possible to avoid loading trigger's body with WHEN clause. And in a case when body is true big (and calls a lot of SPs) and WHEN clause is satisfied really rare, we can have some performance effect here. But telling true I do not think that such game is worth playing - too many conditions should be met. ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel