Steam
Steam

Reputation: 9856

How to get the memory consumed by SQL variables, columns etc.?

I know basic SQL/RDBMS and not the kind of detailed information a highly experienced DBA would know.

I need to know how much memory is consumed by a variable such as int, bigint, date time. I also need to know how much memory is consumed by a Varchar(50) column in two cases -

1] The Column is filled with strings of size 50
2] Column has all Null

The purpose behind this is to make estimates for ETL/data transfer.

I also want to know how to store SQL server result into a cache on disk and then retrieve the data from that cache, chunk by chunk (doing this due to memory related concerns). But, I'll make that another question.

Upvotes: 0

Views: 210

Answers (1)

Sir Crispalot
Sir Crispalot

Reputation: 4854

In addition to the documentation linked in the comment, note that varchar storage depends on what data is actually entered.

From http://technet.microsoft.com/en-us/library/ms176089(v=sql.100).aspx:

The storage size is the actual length of data entered + 2 bytes.

Upvotes: 2

Related Questions