0

I have created table as below.

enter image description here

With the reference of this link. Calculating size of datatypes used for this table

enter image description here

Aim: for this calculation is to predict the size of table for n-users while creating or implementing the table.

Queries: Q.1)

Memory size of Unsigned int min: 0 max: 4294967295 = 4 bytes. 

By allocating int(11) means max: 4294967295 - 11 =4294967281(remaining size)?

or 

By allocating int(11) means  4 * 11 =44 bytes?

Q.2)

consider to create following datatypes used.

int(11)      =4 bytes
Var char(2)  =6 bytes(L+2 bytes(L is string value in byte) consider “amir” so L value is 4 byte)
Date         =3 bytes
-----------------------
Total        =13 bytes
-----------------------

Is above calculation is correct?

Amir
  • 1,066
  • 1
  • 13
  • 26
  • Not sure what you mean by `calculate the size of the above query`? – Rahul Nov 04 '14 at 07:29
  • Have to calculate the memory space occupies for an user 1. If we calculate it for 1 user means. we can calculate it for 100,1000 users. – Amir Nov 04 '14 at 07:33
  • Do you mean size of a record in details table? – Rahul Nov 04 '14 at 07:35
  • @Rahul I think he means the `in memory` size of the result set being retrieved by MySQL for a particular query. – Mihai Stancu Nov 04 '14 at 07:43
  • @Amirjohn alongside the actual data in the table there are indexes. One of them is the primary key (which is a unique index) and any other unique index or normal index ads up. Based on the execution plan of a particular query MySQL will be loading some indexes of a particular table into memory to help filter out data. Calculating the memory consumption affected by this in MySQL isn't going to be very deterministic. – Mihai Stancu Nov 04 '14 at 07:46
  • @MihaiStancu & Rahul sir: Check out my updated questions, – Amir Nov 05 '14 at 06:14

0 Answers0