开发者

Performance: SQL vs. Post

I have 2 webpag开发者_JS百科es, one will contain summary event info (i.e. Artist, City, Date) and the other will contain additional detailed event info (i.e. Time, Lat/Long, Full Address). Users will see the summary info, and be able to click to be taken to the detailed info.

As far as performance is concerned is it best to preload all of the information once from my first page, and then simply pass the additional detailed info to the second page via a post? Or on the first page simply query for the exact data I need, then on the second page, run a query again, this time bring back the additional data?

I'm open to any and all suggestions. Thanks.


Query for the data you need on the first page, then get the second page with its own query. That way you don't risk showing the user stale data (which is really important), plus your application has less moving parts (which is a nice feature) and you can use GET for the detail page so the user can bookmark it (also a good thing). The database will cache the information from the first query so it probably won't be doing a lot of repeated work for the second one.

Typically even when performance is a major concern, you would like to have the caching be orthogonal to your application logic. There are non-intrusive mechanisms like web proxies and using a Hibernate 2nd level cache that are worth considering before you commit yourself to baking caching into your application code.


NO answer can be 100% correct since can change based on: (1) the amount of data you have (ie: how many results on the summary page, how many event total on you DB?) (2) the amount of servers you have (3) the amount of traffic you have (4) your software architecture (ie: what database, webserver, etc...) and (5) how your site is used (ie: are th users typically going to click on 1 or 2 results from the summary page or will they probably click on 20 or 30?). (6) Are you willing to sacrifice accuracy for speed? (ie: how often does the data change and how critical is it for you users to get the ABSOLUTE latest info?) etc, etc, etc, ----

PROBABLY your best bet is to just load the info you need for each page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜