views:

155

answers:

2

How can I calculate the size of a T-SQL query in bytes transfered across the network?

I know I can approximate it by examining data types of columns (varchars are an interesting twist though), but are there tools that'll give me the number of bytes (including and excluding TCP/IP headers) used up while transferring the query and its results to and from the SQL Server?

+10  A: 

If you are using the Microsoft Sql Server Management Studio, you can toggle the "Include Client Statistics" from the "Query" menu.

You will get some network statistics like

  • Bytes sent from client
  • Bytes received from server
  • TDS packets received from server

You can also leave that option on and get an average of all query executions.

Pierre-Alain Vigeant
Yeah, just get the free Management Tools http://www.microsoft.com/express/sql/download/
Chris Haas
Nice! I've been using it for a while, but never noticed that functionality. great!
Allain Lalonde
+1  A: 

Perhaps use a network listener like WireShark? That should give you exact sizes for packets.

Oded