homepage Welcome to WebmasterWorld Guest from 50.17.162.174
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Little help needed optimizing DB usage
for site with heavy traffic
Jakotsu




msg:3724992
 5:18 pm on Aug 17, 2008 (gmt 0)

I've got a page where the user has different content on separate tables, such as photos, videos, messages, etc, and each time a page is viewed, a COUNT(*) query is performed on each table to get the user's content count.

The point is that I need to start avoiding DB queries because some tables are starting to crash often due to heavy access, and I'm not sure how to proceed. The 2 alternatives I handle are:

1. Reading the tables only on user login, and storing required info on $_SESSION variables
2. Creating a "user_status" table with only the user info required to show on all pages, and query it on every page shown

I'd really appreciate to hear some suggestions on which method to show, and if there's a better way to do it. As usual, thanks in advance!

 

LifeinAsia




msg:3725665
 4:21 pm on Aug 18, 2008 (gmt 0)

I'd go with option 1. You probably want to have the queries re-run and updated whenever a user adss/deletes content as well.

I assume you have your tables indexed efficiently?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved