This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Reduce db query frequecy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reduce db query frequecy" Watch "Reduce db query frequecy" New topic

Reduce db query frequecy

SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
Hello, i am trying to find an approach to reduce users' queries to database by querying more records from the database using spatial locality concept. This approach will be used in a news database. The idea is users usually want to read the latest news instead of the older one. However, some user may want to read the old news. It is very similar to the implementation of this board. Can somebody give me a suggestion?
manav kher
Ranch Hand

Joined: Nov 21, 2000
Posts: 98
great idea...why don't u use the simple convinience that web cookies cookies with user behaviour info as cookies (or in ur own database if u like...but thats only valid if users have independent log ons or static ip's etc)
and then use that information to format/sort ur resultsets?
SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
I thought about using cookies, but some parameters may change throught the whole session. Let's say i am view today's news, very likely i want to read yesterday's news. So i will pull all today's and yesterday's news into result set and keep them in session, but presenting today's news to users. If users request for yesterday's news, i just pull the information from the session, no queries are performed. This can improve the effieciency. Is there any design pattern can acheive this purpose?
I agree. Here's the link:
subject: Reduce db query frequecy
jQuery in Action, 3rd edition