Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: Missing sql parameters in sql query pager #388

Open
vmati opened this issue Apr 29, 2016 · 0 comments
Open

Performance: Missing sql parameters in sql query pager #388

vmati opened this issue Apr 29, 2016 · 0 comments

Comments

@vmati
Copy link

vmati commented Apr 29, 2016

SqlQueryPager builds query like this one:

SELECT Count(*) 
FROM   [dbo].[book]; 

WITH __data 
     AS (SELECT [dbo].[book].[id], 
                [dbo].[book].[writerid], 
                [dbo].[book].[name], 
                [dbo].[book].[year], 
                [dbo].[book].[description], 
                Row_number() 
                  OVER( 
                    ORDER BY [dbo].[book].[name] DESC) AS [_#_] 
         FROM   [dbo].[book]) 
SELECT [id], 
       [writerid], 
       [name], 
       [year], 
       [description] 
FROM   __data 
WHERE  [_#_] BETWEEN 6 AND 7

BETWEEN expression does not take sql parameter, just values.
This causes to create new execution plan every time query is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant