Dynamics NAV Database optimization: table partitioning

Large Dynamics NAV databases (lots of Gigabytes of physical space on disk) needs optimization and tuning at a level that can't be done via the standard NAV interface: you've to work directly on SQL Server.

The first level of optimization starts when your database borns I think. You've to carefully design the physical structure of the DB and always split it on different data files, normally located on different disks.

The second step on optimization regards index defragmentation and tuning (I've written in the past something about it).

But what about when you have really large tables to query? NAV is not always so "speedy" on really large volumes (do you remember the SELECT * question that I hate? ).

An interesting way to optimize performances when you have really large tables on your NAV database is using the SQL Server Table Partitioning feature.

Table Partitioning permits you to horizontally split data on a table based on a certain criteria you want and so having queries optimized (less data and on different physical discs with different performances).

How to implement Table Partitioning on your Dynamics NAV database? If you want a non T-SQL way, I recommend to install SQL Server Management Studio 2008. These are the steps:

Open your Dynamics NAV database with Management Studio and select the table you want to partition (for this sample I've selected the Purchase Line table). Right click on it and select Storage --> Create Partitions:

SQLTablePartitioning1

A wonderful Create Partition Wizard will start...

SQLTablePartitioning2

You've to select the table column on whick you want to  create a partition. I've decided to horizontally partition the Purchase Line table for the Expected Receipt Date field (partition by date):

SQLTablePartitioning3

Next, you've to provide the name for your newly created Partition Function:

SQLTablePartitioning4

and for the new Partition Schema:

SQLTablePartitioning5

Next, you've to setup the Boundary of your partition. By clicking the Set Boundaries button you can choose the starting and ending date for your boundaries (<=) and you can choose the Date Range:

SQLTablePartitioning6

This creates the partition ranges by date (on my sample, partitions by years from 01/04/2000 to 01/02/2008).

Next (extremely important) you've to choose the File Group on which you want to place each partition:

SQLTablePartitioning7

This choice must be done with intelligence and it's based on the performance you want to obtain. For example, on my sample I've chosed a partition of the Purchase Line table by date. I suppose that the major number of queries will be done on the most recent records, so it could be a good choice to place the most recent partitions by date (ex. from 2004 to the last) on the top performant disks (physical filegroups) and viceversa the oldest data (rarely queried) on the less performant filegroup.

If you click on the Estimate Storage button you can have also a detail of the required disk space for each partition:

SQLTablePartitioning8

On the last wizard's step you can choose the Output option (if you want to create a script or if you want to launch the partition process immediately):

SQLTablePartitioning9

That's all... simple with this new wizard, isn't it?

Dynamics NAV has lots of tables that on large companies could grow a lot (G/L Entry, Item Ledger Entry, FA Ledger Entry for example...) and this is an optimization trick that you've to evaluate in order to tune up your database.

Technorati Tag: ,

Print | posted on Friday, February 06, 2009 2:24 PM

Comments on this post

# re: Dynamics NAV Database optimization: table partitioning

Requesting Gravatar...
Wow! This was very in depth. I plan on using it on my VB Source site!
Left by vb6 on Mar 05, 2010 7:13 PM

# replica jewelry

Requesting Gravatar...
Wow! This was very in depth. I plan on using it on my VB Source site!
Left by replica jewelry on Apr 29, 2010 3:58 AM

# re: Dynamics NAV Database optimization: table partitioning

Requesting Gravatar...
base is using the SQL Server Table Partitioning feature.

Table Partitioning permits you to horizontally split data on a table based on a certain criteria you want and so ha
Left by wholesale laptop battery on May 23, 2010 2:47 PM

# re: Dynamics NAV Database optimization: table partitioning

Requesting Gravatar...
Thanks for this tut. I am newbie in base and SQL topic so it is little bit hard for me but very usefull.
Left by Rolladen on Jun 08, 2011 12:05 PM

Your comment:

 (will show your gravatar)
 
Please add 5 and 1 and type the answer here: