Welcome to WebmasterWorld Guest from 54.162.155.183

Forum Moderators: open

Message Too Old, No Replies

Little help needed optimizing DB usage

for site with heavy traffic

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

10+ Year Member



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!

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

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month