In trying to optimize a rather large query I discovered that one seemingly small part of the query is actually costing 99.19% of the total batch. It seems so simple, yet its so expensive.
I'm calling a stored procedure which does an insert into another, which in turn fires a trigger. Within this query there are three components, a select statement (0%), computer svalar (0%), and an inserted scan (100%). It says "scanning the pseudo-table "inserted" within a trigger".
So whats the deal with this? Why is this so expensive? Is there any way to optimize this?