How to find the size of the data returned from the table

I have a table that stores snapshots of data. These pictures are marked with 'jan2010' or 'april2011' . All images will grow exponentially over time, and I would like to see if I can predict when we will need to upgrade our storage.

Is there any way

 select monthlysnapshot, sum(size) from tblclaims_liberty group by monthlysnapshot order by monthlysnapshot desc 

What am I missing to get the size of the returned data? Is there a system function that I can call?

0
source share
3 answers

EXEC sp_spaceused 'tablename'

This will return a single result set that provides the following information:

Name - table name

Rows - the number of rows in the table

Reserved - the amount of total reserved space for the table

Data - the amount of space used by the data for the table

Index_Size - amount of space used by table indexes

Not used - the amount of used space in the table

+3
source

Is this what you are looking for?

C # Getting the size of the returned data and SQL query

Modified by:

 EXEC sp_spaceused 'tablename' 

If you can do this in your code, then in C # (change the code to any language you use)

 long size = 0; object o = new object(); using (Stream s = new MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(s, o); size = s.Length; 

Code copied from: How to get the size of an object in memory?

+1
source

I think you can insert the selected data into the table using "select * to newtable from table" and get the size of this newly created table.

0
source

All Articles