Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 64797

key Impact on Database Size.

$
0
0
Hi All,

I am not sure about the article that i am writing that i Should Write it or not. The area that i am about to discuss is something where i am a newbie and would like to explore the area.

The Reason behind article was something asking a query about database size based on keys.

In this article we will see by a small demo how much the database size get increased based on No. of Keys that we have in one table.




Step 1 - Create a Blank Database in SQL & Create a Table in SQL which is same as Navision Item Ledger Entry with only one key.
The Table that is created is same as of Navision Item ledger Entry as shown below.


Step 2 - Check the Database Size before we start inserting Records in table. The Database Size as of Now is 2.27 MB.


Step 3 - Now lets copy records from Standard Cronus Database Looping it 100 times using SQL Query as shown below.


Step 4 - Let's check the database size again and see how much it have grown. The Database Size Now is 15.09 MB.


Step 5 - Let's see What was the Execution plan of the query that we ran in Step 3 to understand how records were inserted.


Step 6- Now i delete that database, Created a New Database but this time Item Ledger Entries have Same Keys as of Navision.


Step 7 - The Database Size as of Now is 2.27 MB. Now i will use same query to insert same no. of Records in the New Table Created with all keys that Navision Have. After execution of Query below is the Database Size that is 71.15 MB.


Step 8 - And Below is the execution plan of the Insert Query that we executed.

I was amazed to see the results when i executed these steps. I am not sure but i guess i can conclude that keys increases the database size as in SQL Data get stored in a sorted manner per key wise.

Below is the Power point of the above discussion.

                

Hope i made a point. If there is something wrong do let me know in comment sections. Your feedback and comments will motivate me to write more about SQL w.r.t Navision.

Queries can be found on my SKYDrive.

File Name - Key Impact.rar

** The table used in the query are based on Cronus India Database. If you are try to use the same query on different country then remove the Indian specific fields which will be highlighted in red when you copy in SQL Query window.
Regards,
Saurav Dhyani

Viewing all articles
Browse latest Browse all 64797

Trending Articles