Pretty normal scenario:
I want to use a single request to the server because the database query is expensive (and I don't want to cache anything on the web server)... so I am thinking of using Comet or flushing just the first page's data, then flushing more script tags for the rest of the data.
Is this feasible? Are there any tutorials/examples of this?
Thanks.
Quite feasible; however I'd do it by making two calls.
On a lower-level protocol it'd be easy to flush but I recall something funny about flushing json.
Change server side interface to accept from and to params, so that you have control over how much gets fetched. Make/change a spoc in SQL to do efficient paging on SQL side (paging part will look like Row_number() OVER(order by MyColumn)). That will actually make first query much faster end-to end (SQL will be sending less that 5% of data - say 100 rows). Then in the second query you can get all the rest or you can split it in 2 or more parts (SQL server is happier sending non-giant blocks as well - efficient paging is relatively new feature - like 5yr old).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With