10
Currently when you subscribe to a Table Event such as OnAfterModifyEvent or OnAfterDeleteEvent it can cause poor performance because statements such as MODIFYALL and DELETEALL no longer cause a single SQL statement to be generated but instead 1 SQL statement is generated for EACH record.

The problem is you may want to subscribe to these events but only when you're not dealing with a temporary record or perhaps only when running the appropriate trigger (i.e. OnModify() or OnDelete()). Now you can tell within your subscription function if you are dealing with a temporary table (using ISTEMPORARY) or only run your code when the trigger is called (check RunTrigger parameter) - but it means that the subscription function is still called even though you don't want to do anything and you no longer benefit from a single UPDATE / DELETE SQL statement.

My request is to have 2 additional Properties (not parameters) added to the Subscription Function...

SkipTemporaryTable
SkipWhenNoRunTrigger

...this means that if you set these to TRUE then...

a) The Subscription function is not called for actions on a Temporary table
b) The Subscription function is not called unless you call MODIFY(TRUE), DELETE(TRUE), MODIFYALL(...,TRUE) or DELETEALL(TRUE).

This can cause significant performance benefit if used properly and is backwards compatible and doesn't break anything (if default is FALSE for the 2 new properties)

P.S. I've discovered this issue because an NAV upgrade I'm working on is having significant performance issues because this this problem - it's mainly the API Graph functionality which is subscribing to such Table events and causing problems
Category: General
STATUS DETAILS
Needs Votes

Comments

K

Yes, this is a good idea.
But in case of
"b) The Subscription function is not called unless you call MODIFY(TRUE), DELETE(TRUE), MODIFYALL(...,TRUE) or DELETEALL(TRUE)."
the use of RunTrigger should harmonized - it seems not always be consitently

Category: General

K

And please add a property "SkipOnChangedCompany" - if an event is raised for a record after changecompany, the event is fired in the currentcompany.

Category: General

K

This is very important, as it prompts the user to consider if the table is temporary. I would even suggest that Skip Temporary table is true by default. There is a huge risk of using a standard table as a tempory table and another extension subscribing to a delete trigger and deleting related records unintentionally.

Category: General

K

I was also about to post the idea of Skip Temporary Table as that is always the first line in my Event Subscriber.

Category: General