| « Case insensitive usernames in Django | Jquery Comments » |
Thursday, October 8th, 2009
Would this work?
Scenario: You have huge database tables with many columns and tons of data. You want to run large reports over all this data and display lots of records at a time.
Suggestion: This popped into my head and I'm curious if it would work or totally over bloat the whole thing. What if you went to the server and got nothing but a list of unique ids to manipulate with javascript, iterate over the list and put an ajax function like jquery.get in there for each id, then use the browser to load each record in the window on document ready?
Small example: You have ten records in the db. You have a view that returns an empty page with a js file and on document ready iterate over a list of all the unique ids 1-10.
Then using ajax, you could load each record into a table or something. Now instead of your entire page having to load all those records from the server before it fires $(document).ready(), you start iterating over this list and you can start loading the content. i think if you used jQuery for this, you could get some really neat effects of the page loading fading in from top to bottom. Would all those hits to the server be too close together for the server to handle? or would putting the function call at the end of the completed $.get() work well?
i know this would work on a ten record report, but if your report had thousands of rows in one view, would this work? seems like most browsers would be able to handle 3000 unique id's pretty easily. i just picture div after div fading in under each other in a really neat wave like effect.
if you know the answer please comment!
main questions: would this destroy the server? pulling one record at a time seems like it shouldn't be a big deal to spit out.
7:52pm by Brandon //comment 1298 views