How would I go about finding the largest objects in a SQL Server database? First, by determining which tables (and related indices) are the largest and then determining which rows in a particular table are largest (we’re storing binary data in BLOBs)?
Are there any tools out there for helping with this kind of database analysis? Or are there some simple queries I could run against the system tables?
I’ve been using this SQL script (which I got from someone, somewhere – can’t reconstruct who it came from) for ages and it’s helped me quite a bit understanding and determining the size of indices and tables:
Of course, you can use another ordering criteria, e.g.
to get the tables with the most rows, or
to get the tables with the most pages (8K blocks) used.