473,378 Members | 1,152 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

MSDN's Estimating the Size of a Table

I was hoping I can get some help regarding subject mater located at
http://msdn.microsoft.com/library/de...es_02_92k3.asp

MyTable has 23 fields with 100,000 records.
Field1 nvarchar 90
Field2 char 6
Field3 varchar 8000
Field4 nvarchar 200
Field5 nvarchar 200
Field6 nvarchar 200
Field7 nvarchar 200
Field8 nvarchar 200
Field9 char 30
Field10 char 30
Field11 nvarchar 200
Field12 nvarchar 200
Field13 float 8
Field14 datetime 8
Field15 datetime 8
Field16 datetime 8
Field17 nvarchar 200
Field18 nvarchar 200
Field19 varchar 8000
Field20 nvarchar 200
Field21 nvarchar 200
Field22 nvarchar 200
Field23 varchar 8000

Data Types:
nvarchar = Variable-length, Storage is 2 times the # of characters entered
char = Fixed-length. Storage is n bytes
varchar = Variable-length, Storage is actual length in bytes of data entered
float = Is float Fixed-length?, my precisions are 15 digits so 8 bytes.
datetime = Is datetime Fixed-length?, Storage is 8 bytes
I need the following blanks filled in for me, please :-)

Num_Rows 100,000
Num_Cols 23
Fixed_Data_Size
Num_Variable_Cols 16
Max_Var_Size
Null_Bitmap Int(2 + ((23 + 7) / 8)) = 5?
Variable_Data_Size
Row_Size
Rows_Per_Page
Free_Rows_Per_Page 100 (no clustered index created)
Num_Pages
Table Size


Jul 20 '05 #1
2 9718

"TZone" <TZ***@optus.com.au> wrote in message
news:3f***********************@news.optusnet.com.a u...
I was hoping I can get some help regarding subject mater located at
http://msdn.microsoft.com/library/de...es_02_92k3.asp


<snip>

You're correct that float and datetime are fixed length, and both are indeed
8 bytes (for your float precision, as you noted), which seems to be your
main question. You just need to follow the formulas in the documentation.

One point you may need to consider is how full the average variable length
column will be - if you know that almost all data in an nvarchar(100) column
will be around 50 Unicode characters, ie. half the length of the field, then
you could count that as 100 bytes instead of 200 to get a more accurate
estimate. Or if the average will be around 75, then count 150 etc. But
you're the only person who knows what your data looks like, so you're the
best person to calculate the size of the table.

Simon
Jul 20 '05 #2
After following formula in documentation I arrive at:

Num_Rows = 100,000
Num_Cols = 23
Fixed_Data_Size = 98 bytes
Num_Variable_Cols = 16 fields
Max_Var_Size = 8000 bytes ** Field3 is varchar with length 8000, so is this
8000 bytes?***
Null_Bitmap = 5
Variable_Data_Size = 8034
Row_Size = 8141
Rows_Per_Page = (INT(8096/(Row_Size + 2)) ** is zero correct?**
Free_Rows_Per_Page = 100 (I have no clustered index)
Num_Pages = -1000 ** is this correct, a negative Num_Pages?**
Total Size (Mb) = -7.81

MyTable has 23 fields with 100,000 records.
Field1 nvarchar 90 * variable*
Field2 char 6 *fixed*
Field3 varchar 8000 *variable*
Field4 nvarchar 200 *variable*
Field5 nvarchar 200 *variable*
Field6 nvarchar 200 *variable*
Field7 nvarchar 200 *variable*
Field8 nvarchar 200 *variable*
Field9 char 30 *fixed*
Field10 char 30 *fixed*
Field11 nvarchar 200 *variable*
Field12 nvarchar 200 *variable*
Field13 float 8 *fixed*
Field14 datetime 8 *fixed*
Field15 datetime 8 *fixed*
Field16 datetime 8 *fixed*
Field17 nvarchar 200 *variable*
Field18 nvarchar 200 *variable*
Field19 varchar 8000 *variable*
Field20 nvarchar 200 *variable*
Field21 nvarchar 200 *variable*
Field22 nvarchar 200 *variable*
Field23 varchar 8000 *variable*

I'm going to assume all variable fields are close to maximum capacity.

Thanks for previous reply Simon!


"Simon Hayes" <sq*@hayes.ch> wrote in message
news:3f**********@news.bluewin.ch...

"TZone" <TZ***@optus.com.au> wrote in message
news:3f***********************@news.optusnet.com.a u...
I was hoping I can get some help regarding subject mater located at

http://msdn.microsoft.com/library/de...es_02_92k3.asp


<snip>

You're correct that float and datetime are fixed length, and both are

indeed 8 bytes (for your float precision, as you noted), which seems to be your
main question. You just need to follow the formulas in the documentation.

One point you may need to consider is how full the average variable length
column will be - if you know that almost all data in an nvarchar(100) column will be around 50 Unicode characters, ie. half the length of the field, then you could count that as 100 bytes instead of 200 to get a more accurate
estimate. Or if the average will be around 75, then count 150 etc. But
you're the only person who knows what your data looks like, so you're the
best person to calculate the size of the table.

Simon

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ws_dev2001 | last post by:
Hello all, I am trying to obtain the size of a java object in C by using JNI. As we do not have a proper implementation of this in java, I decided to see if C could provide me some accurate data....
2
by: sympatico | last post by:
I am looking for a good document of spread sheet that can help me better estimate the amount of time and money a software development project should take. I am using .NET Framework I have been...
3
by: Stewart Graefner | last post by:
I Started working on a db I'm building as a hobbie, However it has turned into quite a project. I have copyrighted it just incase. Now I'm wondering How do I assess its value if I wanted to sell...
3
by: David Parker | last post by:
Given a table, foo, created in a database but not populated, is there a procedure that will return an estimate of the size of a given tuple in that table? It looks like pgstattuple reports on...
7
by: Roy Smith | last post by:
I've got a large text processing task to attack (it's actually a genomics task; matching DNA probes against bacterial genomes). I've got roughly 200,000 probes, each of which is a 25 character...
0
by: acbcompute | last post by:
This book was just released in ebook and is due in hardcopy in a couple weeks... http://www.porterlearning.com/publications.html "Estimation with Use Cases: A Simple and Effective Approach...
1
momotaro
by: momotaro | last post by:
The mathematician Gottfried Leibniz determined the following formula for estimating the value of Pi (3.1415…): Pi/4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + …. Evaluate the first 200 terms of this...
2
by: ibmdb2user | last post by:
Hi all, The table in question has 4 fields: UNID 19 chars DATA 2147483647 (BLOB) ROW 19 chars DT 10 chars Second column can take upto 2GB (attachments etc). So I am trying to figure out the...
1
by: Harshaw | last post by:
I am an estimator for an industrial and commercial insulation contractor. I have compiled an enormous amount of data over the years but I am still figuring all of my estimates by hand. For instance,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.