sql server - Which query would be better for Paging? -


which query better paging query 1 or query 2

query 1:

select ceiling(convert(decimal,count(*))/@pagesize) totalpages  table 

query 2:

select (count(*) + @pagesize - 1)/@pagesize totalpages  table 

bases on sample i'll go query 2

but technically speaking both have same performance in sql server, try executing them , see execution plan.


Comments

Popular posts from this blog

node.js - StackOverflow API not returning JSON -

ios - Apple Push Notifications + TestFlight + Enterprise wildcard provisioning profile -

android - Drag and drop in ScrollView -