How to get same Execution Plans in a test-db?

pdj
Member Posts: 643
I'm currently trying to optimize indexes based on "expensive" queries found using scripts from Lars Lohndorf-Larsen. (http://blogs.msdn.com/b/nav/archive/200 ... story.aspx)
This database is rather big, so I can't just create and drop indexes in the live database, so I would like to do some testing in a test database first. However, after having restored the live-db into a new test-db, then SQL doesn't show the same estimated execution plan in the two databases.
Both the data and the statistics are identical, so how can the estimated execution plans be different?
And how do I fix it, so I can reproduce the same situation in my test-db?
Thanks in advance.
This database is rather big, so I can't just create and drop indexes in the live database, so I would like to do some testing in a test database first. However, after having restored the live-db into a new test-db, then SQL doesn't show the same estimated execution plan in the two databases.
Both the data and the statistics are identical, so how can the estimated execution plans be different?
And how do I fix it, so I can reproduce the same situation in my test-db?
Thanks in advance.
Regards
Peter
Peter
0
Comments
-
pdj wrote:I'm currently trying to optimize indexes based on "expensive" queries found using scripts from Lars Lohndorf-Larsen. (http://blogs.msdn.com/b/nav/archive/200 ... story.aspx)
This database is rather big, so I can't just create and drop indexes in the live database, so I would like to do some testing in a test database first. However, after having restored the live-db into a new test-db, then SQL doesn't show the same estimated execution plan in the two databases.
Both the data and the statistics are identical, so how can the estimated execution plans be different?
And how do I fix it, so I can reproduce the same situation in my test-db?
Thanks in advance.
The data you need is in RAM, which obviously doesn't come across. Maybe there is some way, but I don't think so ... but am very interested if there is. What you would need to do is to create artificial load to replicate the circumstances that got the live system where it is.David Singleton0 -
Hi David,
Thanks for you answer, but do you know what this information is called? Just so I know what to search for... :?
I guess I could do a long recording using the Profiler and replay it in the db, but I would like to avoid slowing down the live-db more then necessary. I guess I have to do my testing on the live-db outside working hours, if I don't find a way to copy this informationRegards
Peter0 -
pdj wrote:Hi David,
Thanks for you answer, but do you know what this information is called? Just so I know what to search for... :?pdj wrote:I guess I could do a long recording using the Profiler and replay it in the db, but I would like to avoid slowing down the live-db more then necessary. I guess I have to do my testing on the live-db outside working hours, if I don't find a way to copy this informationDavid Singleton0 -
Keep in mind also that in a live environment, you are going to have many users sharing cache, so you might get a test environment that is identical to live, but since there is plenty of available RAM, the process you test will run much faster, than in a server where there is limited RAM and it is being frequently flushed.
And then comes blocking...
And then the channel to you storage array...David Singleton0 -
It is not a problem the test-db is slower, I just need it to use the same execution plans. I can easily see which index the live-db is using for a specific statement, which should be changed.
I guess I have to do it in the live-db, if the customer can find a service window I can live withRegards
Peter0 -
One thing about index tuning: Do it in the NAV table designer, not directly on SQL Server. You can't just change indexes either, you have to make sure the code is actually using the key as well.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions