SQL Anywhere 11.0.1.2527 Does "Trigger Event" block the caller until the event has completed? We're looking to call an event in an AFTER INSERT trigger which could potentially perform an expensive operation. So will the "Trigger Event" call block the insertion at all? |
Be aware that you can run into timing Problems if you insert the Rows Faster as your Event can finish his task. @Thomas - Can you expand on this? I was under the impression that TRIGGER EVENT fired off a new Event every time it was called where every Event is running with its own connection. Assuming every Event is self-contained, how would there be timing issues? Of course we'd certainly code against any scenario that might end up firing Events at a rate where we end up with 100's or more running Events. @Nick What you describe happen to me one time when the trigger had to update 200 rows after the insert of one row in a table. The updates the fired triggers needed to do had overlapping rows. Result was many trigger connection blocking each other. Comment Text Removed
1
@Nick, @Thomas: In case your event just has to notify another application, I would suggest to code the event that only one (or a few) instances of the event can run (i.e. do work) at the same time, and more instances would just start and close. "NumActive" is of help here - cf. sqla.stackexchange.com/questions/958. - Or you might turn to using STATEMENT level triggers, if that helps. |
In addition to what Volker said: Using events to "fire and forget" time-consuming operations is an excellent way to increase concurrency; i.e., it's a good idea :)