I have implemented pagination using SQL and stored that result of search into temporary table.
Temporary table is named after unique tab id.
So that other tab can have seperate result sets.
That table can be deleted using unload event of browser.
Now issue I am getting is, sometimes browser crash or system restart, unload event is not firing up.
I have to store into temporary table due to large result size (that's what I found easy to implement).
And it is not feasible to apply search query on each first, previous, next, last navigations.
Is there a better way to handle this scenario?
SELECT * INTO Search_1587904945298 -- Timestamp as unique id using javascript new Date().getTime()
FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY OrderDate ) AS RowNum, *
FROM Orders
WHERE OrderDate >= '1980-01-01'
) AS RowConstrainedResult
WHERE RowNum >= 1
AND RowNum < 20
ORDER BY RowNum