How to Find Actual Data Size from a Query in SQL Server

size;t-sql

Is it possible to find the size of data that will be returned by a particular query?

For example, I can use the following to find the number of rows per date:

select mydatecolumn, count(*) 
from MyTable
where mydatecolumn < '01-JAN-2014'
group by mydatecolumn

But is there a way to find out the size of the data that is contained in those rows?

e.g.

select mydatecolumn, "sizeofactualdata",
from mytable
where mydatecolumn < '01-JAN-2014'
group by mydatecolumn

Even if it's one query per date that's not a problem.

Best Answer

Here is a way of How to calculate the Result Set data size

If using Management Studio:
Go to Menu >> Query >> Include Client Statistics enter image description here
Once you enable the client statistics, it will display another tab in the result span; when clicked, we obtain the following: enter image description here

As shown in the image, it will capture details for different trials and they are compared with each other. Green arrows indicate improved statistics and red arrows indicate degrading statistics. Please note that here an increase does not always imply a good result; sometimes some statistics when marked as “up” can imply a bad result as well. For the same reason, they are colored in green and red, signifying good and bad results, respectively.