0

I'm investigating some issues with parameterization for our app, which uses Sql Azure. I'm using the query store and analyzing the following 2 queries, which are similar.

See following image:

Query store results There are several things I don't understand.

Our application doesn't actually parameterize this query. Both the ShopId and order_id parameters are actually inlined by our app. Even more strange, the query that we sent doesn't send [order_id] = <id>. Instead it sends [order_id] IN (<list of ids>). Often, there will be a single id in the list.

1) I understand that Sql Azure can automatically parameterize. However, the second query shows a query_parameterization_type_desc of None. Yet, the query_sql_text shows that the query was auto parameterized. Why is that?

2) My understanding was that the query_sql_text was the text provided by the user (our app). However, it seems to actually be the text computed by Sql Azure once it's done its auto-parameterization, and also realized it could replaced the IN clause with an = since there was a single value in the IN. Is that right?

3) Both queries have different query_text_id but the query_sql_text is exactly the same. Why is that? Also, why is the statement_sql_handle is different? I get the feeling that maybe the handle is based on the raw text of the query, before SQL azure made transformed it into its canonical text. But I also did read that the text stored is supposed to be the raw text so I'm quite confused.

Can anyone shed some light?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.