locked
How to configure EnableQueryPlanCaching in Data Services RRS feed

  • Question

  • Is there a way in the Data services configuration to specify whether to turn-on query-plan caching for the l2e queries it generates? If I understand correctly, Data Services takes the OData query and transforms it into a l2e query to execute against your EF context. If this is the case, you should be able to specify if these queries use the query-plan caching via the EnableQueryPlanCaching flag or some other setting. Is this true? Or am I incorrect in how this all works?

    Best.

    Ryan

    Friday, March 4, 2011 10:43 PM

Answers

All replies

  • Hi Ryan,

    As far as I know, WCF Data Services cannot config the query plan for the EF context directly.   Generally, we can control the query plan caching via EntityCommand.EnablePlanCaching.   http://msdn.microsoft.com/en-us/library/bb738562.aspx.  So, maybe you can create a Service Operation and execute EntitySQL in the operation method to enable/disable query plan caching.   http://msdn.microsoft.com/en-us/library/cc668788.aspx

    Pam

    • Marked as answer by rkbrown Wednesday, March 9, 2011 4:58 PM
    Tuesday, March 8, 2011 1:58 AM
  • Thanks for the response Pam. I had thought of that. Unfortuantely, I don't believe that will work for our situation as we are using Data Services as a pseudo, ad hoc query engine against our doamin models. So, we are essentially allowing our clients (all internal consumers) to use OData queries to request any number of combinations of data. So, unless I am missing something, this would not be possible (or more acurately, reasonably acheiveable) with service operations.

    Ryan

    Tuesday, March 8, 2011 3:24 PM
  • Ryan,

    So I believe it would be very hard to fill your request.  But why do you want to control the query plan cache?  I think it's quite fine to let EF handle this itself. 

    Pam

    Wednesday, March 9, 2011 2:00 AM
  • Pam,

     

    It is actually more of a request from our DBA director to see if it is possible. I think after his review of how EF handles it he will be satisfied. But, it would be nice to be able to have the control if any questions or quirks arise in his technical review.

    Thanks! I will close this post.

    Ryan

    Wednesday, March 9, 2011 4:58 PM