Ctrl-alt-geek
Archives: October 2012
Don’t believe everything you read: Truncate table is not logged
Actually I’m not sure if anyone still believes this anymore. If you read the BOL description carefully it states that truncate de-allocates the pages rather than deleting the rows – meaning only the de-allocations are logged – resulting in far fewer log records. Incidentally this is also why the truncate… Read more
1 comments, 2,535 reads
Posted in Ctrl-alt-geek on 31 October 2012
Quick tip: Count table rows in a database, and locate those rows in the data files.
Here are a couple of quick database and table level queries that I have found useful lately.
How many rows in each table of a database?
The first temptation with this one was to use something like sp_MSforeachtable with a count(*), until I recalled that the catalog view sys.indexes has… Read more
0 comments, 417 reads
Posted in Ctrl-alt-geek on 30 October 2012
Querying database usage
A question that a DBA will often be asked is what databases are actively being used on my SQL Server? We get asked it all the time, usually as part of a consolidation or rationalisation project.
My solution to this is to query the sys.dm_db_index_usage_stats DMV, which maintains counters of… Read more
0 comments, 1,582 reads
Posted in Ctrl-alt-geek on 17 October 2012



Subscribe to this blog