Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5179
  • Last Modified:

Please explain how to calculate table size by hand (using the provided example)

Hi experts...

here is the example I have for you:

http://www.marcoullis.com/EE_DB/

I am trying to learn how to calculate table size, and to be honest I need a dumbed down explanation. Other explanations I have found on the EE website are too complicated. No need to calculate all the tables provided, just if someone could run through one table calculation on the "Tenants.sql" database, and one on the "Rental_Unit" database that would be real cool.

Specifically:

1. The "tbl_Tenant" table in database "Tenants.sql
2. The "tbl_Rental_Unit" in database "Rental_Unit.sql"

The dbms is MySQL. The ERD's are for two database that form the backend of a content management system for a large rental apartment corporation in Washington DC... its an exercise from my school book. I am not interested in specific dbms handling of table calculation, just the theory behind how to calculate table size. Preferably a step-by-step approach that a norom (backwards moron) like myself could understand.

There are no variable length fields, just fixed length.

The "tbl_Rental_Unit" table employs the use of data blobs for all the columns named "Schema_". These are very large pictures of schematics...

Thats all I have... please help...

-Panos
0
marcoullisp
Asked:
marcoullisp
  • 6
  • 3
  • 3
  • +2
1 Solution
 
peter57rCommented:
Hi marcoullisp,
Do you mean table size or record size?

Pete
0
 
marcoullispAuthor Commented:
Table size. I want to be able to estimate/calculate the table size for each of the tables shown in the example, and if you could show by example doing the two I have mentioned, that would help me.

But out of curiosity (please don't laugh) whats the difference between record size and table size?

-Panos
0
 
peter57rCommented:
marcoullisp,
Record size is the size of one record and is generally impossible to calculate unless everything is fixed length (which (a) would be very unusual and (b) since you are using BLOBs does not apply to your tables).

Table size is dependent on how much data you have and you generally have to use indirect methods to <estimate>  the size.
I think for MySql you would probably have to export the data to a txt file and see how big that was.  The bit missing from this though is all the dbms overhead involved in storing fields and records which is why it is only an estimate.

Pete
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
marcoullispAuthor Commented:
Pete: I want the step-by-step logic/process for calculating the size of a table. I don't want the dbms tips and tricks method... just the theory. Also I am not worried about indexes, TRX logs and such for now. I will create a different ticket on EE for that after I understand this first.

-Panos
0
 
marcoullispAuthor Commented:
... and I want to learn this logic or process by using the two examples I mentioned earlier...

-Panos
0
 
Raynard7Commented:
If you run:

show table status from `schemaName`

This will return:

Name                      
Engine  
Version  
Row_format    
Rows  
Avg_row_length  
Data_length    
Max_data_length  
Index_length  
Data_free  
Auto_increment  
Create_time          
Update_time          
Check_time          
Collation        
Checksum  
Create_options      
Comment                                    

Of these the Data_length is the total size (in bytes) of each table
0
 
marcoullispAuthor Commented:
... guys ... you don't understand ... this DB is still in Visio. Its an example from a book. I don't have the dbms thing hooked up ... there is no such DB in existence right now. Its just a theoretical example, thats all.

What I am looking for is the theory behind how to m-a-n-u-a-l-l-y estimate/calculate the size of a table in a database, using the two examples I cited earlier, namely:

1. The "tbl_Tenant" table in database "Tenants.sql
2. The "tbl_Rental_Unit" in database "Rental_Unit.sql"

You can find the specific example here:

http://www.marcoullis.com/EE_DB/

Thanks,

Panos
0
 
peter57rCommented:
I can't see that there is any theory involved.

You calculate the space requirements for each field; add them together for the size of one record and multiply by the number of records.
The space requirements for a field in mysql are shown here, amongst other places:
http://info2html.sourceforge.net/cgi-bin/info2html-demo/info2html?(mysql.info.gz)Storage%2520requirements

But as I have already said, where you have a blob there is no 'standard' answer. YOU have to decide how big you think each one will be.  

Pete
0
 
pootle_flumpCommented:
As stated - the table size is the sum of the data stored within it (plus an overhead specific to the RDBMSs method of storage). As such the answer to the size of a table in visio is zero. That table schema could (once realised in a database) have any size - it is dependant on the number of rows and, as Pete says, the size of the rows. Also - I don't know how MySQL handles this but many RDBMSs don't actually store BLOBS but just pointers to the files themselves. As such - the specific RDBMS *does* affect the table size.

I know this isn't that answer you are looking for but I don't believe there is one!

HTH
0
 
pootle_flumpCommented:
Beg your pardon. Just noticed you have the number of rows in the link - I missed that :-)
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
Hi marcoullisp,

This link will give you an idea of how to estimate the sizq of the table

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_02_92k3.asp

Cheers!
0
 
marcoullispAuthor Commented:
aneeshattingal and all:

here are the instructions from the MSDN website. Could any of you walk me through this, step-by-step, on just one table, say this one:

1. The "tbl_Tenant" table in database "Tenants.sql

From this:

http://www.marcoullis.com/EE_DB/

Just walk me through just one. Its not the one with the blobs, and there are no variable length fields in there. I just need to know how to calculate the size of each data field essentially.

-Panos
0
 
pootle_flumpCommented:
Hi Panos

The size of the table is equal to the size of the rows * the number of rows.

The size of a row is the sum of the size of all the fields.

You have a table schema and an excellent link from Pete. If you check the link (you need to copy and paste - the full link is not active) you are given the size in Bytes for each data type.

Have a go. Post what you get and your working. We will help you from there. If you read the terms of use to this site you will see that we cannot do your homework. We are not just being awkward. We can point you in the right direction but you must do the hard work :-)

HTH
0
 
marcoullispAuthor Commented:
From the "tbl_Tenants" table I get that the CHAR (10) fields each have size 10 bytes each (or is it 10 bits each?). There are 7 of them so just those field = 7 x 10 = 70 bits/bytes per row. Now, how do I account for the short fields and the one currency field?

-Panos
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 6
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now