web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SQL-Server Plan Guide for DAX SQL with DataAreaId/Partition "Parameter Sniffing Fix"

(0) ShareShare
ReportReport
Posted on by 119

I have a SQL plan guide working for a DAX select and a delete with the help of Vilmos Kintera.  Now I have SQL that DAX supplies the DataArea and Partition as values in place of parameters.  The SQL also has parameters so it is a mix of a parametertized query and a query with values.  I am attempting to apply a plan guide but so far all I have been able to do is create a plan guide for each value I have for dataArea.  What I think can be done is to create a template that forces parameterization of the entire query and then a second plan guide against the parameterized query that forces the plan.  Has anyone done this with a mixed query like I have ?  One example is DELETE FROM INVENTSUMDELTA WHERE (((PARTITION=5637144576) AND (DATAAREAID=N'540')) AND (TTSID=@P1)).  I am forcing a plan on this delete given SQL looses its mind now and then and does not use the index that matches the where clause despite or index maintenance efforts.  Once this happens things goes south fast with inventory adjustments of any kind deadlocking / blocking all over the application.

*This post is locked for comments

I have the same question (0)
  • Vilmos Kintera Profile Picture
    46,149 on at

    Just for the other forum readers' sake I will link the original topic, since this is related:

    community.dynamics.com/.../214863

    Regarding your current issue, since the statement executed must be a 100% match for the plan guide, I think you do need to create all possible versions if the partition id and dataarea id are within the query text. However, I might be wrong since I am not a database ninja and my SQL-fu is somewhat limited.

    If someone has access to a DBA, I wouldn't mind if you could share more details for the topic as well, since I am interested too.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans