Hi
In paging data we need to number of records count.
Then I can use two method:
FIRST: execute a count sql query in separate command.
I use C# and Transaction for this.
SECOND: execute count over() in above query.
Which of this is efficient and faster?
thanks.
What I have tried:
FIRST: execute a count sql query in separate command
*
SELECT count(*) from tbl
*
SELECT * FROM (
SELECT *, ROW_NUMBER() OVER (id) AS RowNumber from tbl
) t where RowNumber Between 1 AND 50
SECOND: execute count over() in above query.
SELECT * FROM (
SELECT *, ROW_NUMBER() OVER (id) AS RowNumber, COUNT(*) OVER() As RowsCount from tbl
) t where RowNumber Between 1 AND 50