tsql - How to optimise paging in SQL Server when you order by a non indexed field -
tsql - How to optimise paging in SQL Server when you order by a non indexed field -
i have read , followed instructions here: what efficient method of paging through big result sets in sql server 2005? , becomes clear i'm ordering non-indexed field - because it's generated field calcuations - not exist in database.
i'm using row_number() technique , works pretty well. problem stored procedure pretty big joins on fair bit of info , i'm ordering results of these joins. realise each time page has phone call entire query 1 time again (to ensure right ordering).
what (without pulling entire result set client code , paging there) 1 time sql server got whole result set page through that
is there built-in way accomplish that? - thought views might can't find info on this.
edit: indexed views not work me need pass in parameters. got more ideas - think either have utilize memcached or have service builds indexes in background. wish there way sql server table , hold onto whilst paged...
i not familiar paging, , without knowing logic behind procedure, can guess you'd benefit indexedviews or #temporarytables indexes.
you mentionned ordering non-indexed field generated, info combined fact procedure calls entire query every time lead me believe create query indexedview. you'd improve performance accessing multiple times , enable add together index onto field you're ordering by.
you utilize #temporarytable if somehow stays live during paging requests... insert dataset working in #temporarytable, can create index t-sql on generated colum.
indexed views sql server 2005: http://technet.microsoft.com/en-us/library/cc917715.aspx
sql-server-2008 tsql
Comments
Post a Comment