Which request would be better for paging?

Which request would be better for swap request 1 or request 2

Request 1:

select CEILING(CONVERT(decimal,Count(*))/@PageSize) as TotalPages FROM  Table

Request 2:

Select (Count(*) + @PageSize - 1)/@PageSize as TotalPages FROM  Table
+3
source share
1 answer

Basics on your sample I will go for request 2

But technically speaking, they both have the same performance in SQL Server, try to execute them and see the execution plan.

+1
source

All Articles