We have about 2'000 "old" objects in a sql server database (tables, views etc.) of which we don't really know if they're still in use. I want to create an extended event listener for these objects. I tried to add a giant WHERE
clause to the CREATE EVENT SESSION
command, consisting of 2'000 [package0].[equal_int64]([object_id], (<objectId>))
statements.
However, the command max length is 3'000 characters, so I cannot do this. And I guess that the performance of this filer wouldn't be too good, anyway...
Now my question is: I can query all possible predicates using select * from sys.dm_xe_objects where object_type= 'pred_compare'
. this gives me results such as name=equal_uint64
, package_guid=60AA9FBF-673B-4553-B7ED-71DCA7F5E972
. the package_guid refers to sys.dm_xe_packages
, where several DLLs are referenced which seem to implement a particular predicate.
Would it be possible to define my own "package" and implement a predicate there (which would filter the objectId using a hashtable)? Is it possible somehow to import such a package into SQL server so I could define a custom predicate?
Or does anyone have another idea how to implement such a filter?