MSSQL Parameter names

Posts   
 
    
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 20-Jul-2011 07:58:34   

Hey,

after hard migration from 1.0.2005 to newest LLBLGen Pro I looked to sql profiler and noticed that parameter name creation was changed. Before was like: @AliasName, now is like @p1, @p2,.., @pN...

Is it possible to return back old good query generation for this? simple_smile When analyzing queries with many parameters and looking what value is inserted in the column which is 25th in the list.. is quite hard simple_smile

I think here could be configurable if possible or smth.. Any ideas? simple_smile

with best regards Mantas

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Jul-2011 17:26:35   

The reason this is done is to make sqlserver re-use queries more. A query is converted into an execution plan and based on the exact sql string, it's cached. If a query changes based on parameters, it could be that the query is compiled into a new execution plan while this shouldn't have been the case.

It also makes queries smaller.

In our upcoming profiler (separate tool) you can easily watch the queries and replace parameters with the real values.

We won't go back to the original names, sorry simple_smile

Frans Bouma | Lead developer LLBLGen Pro
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 20-Jul-2011 18:10:12   

Otis wrote:

The reason this is done is to make sqlserver re-use queries more. A query is converted into an execution plan and based on the exact sql string, it's cached. If a query changes based on parameters, it could be that the query is compiled into a new execution plan while this shouldn't have been the case.

It also makes queries smaller.

In our upcoming profiler (separate tool) you can easily watch the queries and replace parameters with the real values.

We won't go back to the original names, sorry simple_smile

I think string does not change in both naming cases.. simple_smile "Makes query smaller.." maybe it makes some microseconds to send faster over the network.. simple_smile

Anyway, to implement small switch in config file and let choose to customer wont be very hard, or? simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Jul-2011 10:08:15   

cerberis wrote:

Otis wrote:

The reason this is done is to make sqlserver re-use queries more. A query is converted into an execution plan and based on the exact sql string, it's cached. If a query changes based on parameters, it could be that the query is compiled into a new execution plan while this shouldn't have been the case.

It also makes queries smaller.

In our upcoming profiler (separate tool) you can easily watch the queries and replace parameters with the real values.

We won't go back to the original names, sorry simple_smile

I think string does not change in both naming cases.. simple_smile

it might. Not all parameters are constructed from field names, as sometimes a parameter is constructed from variables in an expression in a linq query. This led to artificial names with hashes to make them unique, but this actually led to plan trashing in some situations. We therefore created a simpler system, which never has this problem.

"Makes query smaller.." maybe it makes some microseconds to send faster over the network.. simple_smile

If you use a lot of parameters, lots of long names, and lots of queries it adds up.

Anyway, to implement small switch in config file and let choose to customer wont be very hard, or? simple_smile

It actually is less simple than you think. The parameters have to be created from field names, which isn't always available. To add code to make things worse, no, we won't do that.

Frans Bouma | Lead developer LLBLGen Pro