|
Posted by Erland Sommarskog on 04/13/07 07:06
pbd22 (dushkin@gmail.com) writes:
> I will go through this in detail after I get home. But, for now,
> I am wondering if it is more cost-effective to do the paging logic
> on the client or the server? I have already written all my paging
> logic in javascript (basically, what that link provides, but in
> javascript). Do I save on performance by moving the paging away from the
> server or do you think it matters?
Disclaimer: I have no personal experience of writing web apps, so take this
as a grain of salt.
If you can be sure that the search can never return more than, say, 1000
rows (and this can be acieved by using TOP), reading all rows in one go,
and then page from the web server is likely to be better, since else
there would be an access to the database each time the user presses next.
But if the search could hit tens of thousands of rows, you need to have
some sort of batching mechanism, because if 100 users do that at the same
time, your web server will choke.
And you should not send all rows at once to the browser, unless the user
requests to see all rows. If the browser is on a slow connection, that
can be painful.
Finally: don't forget to give the user the option to see at least 100 items
at once. I hate sites where I only get a spoonful at a time.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|