February 22, 2016 at 2:18 pm
Hi,
Actually i have a huge Production DB with different machines identified by an id (Machineid), so , now i need to monitor each machine (last write data timestamp), my first idea was to implement a trigger (AFTER INSERT) and create another table (Timestamp,Machineid), then when a data was inserted, the trigger update the Timestamp field on the table using the Machine.
Im not sure if this is the most optimal solution or not (db performance). Ill really appreciate your help with this!.
February 22, 2016 at 2:36 pm
I'd suggest you to use extended events. There are many places where you can find information about how to do what you want.
February 22, 2016 at 5:06 pm
sergio.arv (2/22/2016)
Hi,Actually i have a huge Production DB with different machines identified by an id (Machineid), so , now i need to monitor each machine (last write data timestamp), my first idea was to implement a trigger (AFTER INSERT) and create another table (Timestamp,Machineid), then when a data was inserted, the trigger update the Timestamp field on the table using the Machine.
Im not sure if this is the most optimal solution or not (db performance). Ill really appreciate your help with this!.
You don't need a separate table or a trigger. Lookup sys.dm_db_index_usage_stats in Books Online.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 23, 2016 at 2:15 am
It's a complex topic and there is no quick win.
Triggers will likely be a performance disaster, forget about it.
Trace could help, but again could turn into a performance nightmare and/or huge waste of disk space.
Extended Events will likely help, but support in 2008 is very limited. I wrote a blog post on the topic that you can find here: http://spaghettidba.com/2015/04/20/tracking-table-usage-and-identifying-unused-objects/
The idea behind is that you can use Extended Events to capture reads and writes to a table and record them to a target table. I have no idea whether this could end up working in 2008 though. Sure thing, it won't work as it is, you will need to rewrite parts of the code.
Good luck!
-- Gianluca Sartori
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply