none
Query Performance Insight - Matching SQL with Corresponding LINQ RRS feed

  • Question

  • Hi,

    We are using Azure Query Performance Insight feature to spot the most problematic queries in terms of CPU and physical read consumption. Our project leverages EF (not Core) and contains a lot of legacy LINQ expressions, quite complicated sometimes. So essentially the SQL queries we explore are all generated from LINQ.

    We find it quite difficult to match the resulting SQL with the source LINQ expressions in order to optimize the latter. Sometimes we still are able to do that manually but it's cumbersome. We're thinking on a way of automatizing this process by implementing a functionality similar to the tagging feature introduced in EF Core recently. However our idea was to inject tags to SQL automatically whenever a query gets executed. The tag would contain an information about the source file and line number where the execution started. That would help us to identify the original expression and optimize it.

    Have anyone else implemented a similar approach? And is there a simpler way to identify the original LINQ expression given the resulting SQL?

    Thanks in advance!

    Tuesday, September 17, 2019 8:37 PM

All replies