SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict proph3t's Avatar
    Join Date
    Jun 2004
    Location
    Arizona
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Slooow SQL Query

    Heres the deal. I have a large, large database of users. I have a script (one that I didn't write, but that was given to me as part of a project to complete) that query's the user table and then outputs them in three different formats:
    - Most Active
    - Top Monthly Revenue
    - Top Yearly Revenue

    When I put this on the website though, it runs incredibly slow, and you have to wait about 8 seconds for the page to load each time it's displayed.

    I need to come up with a way to speed this up, and heres what I've come up with:
    - Cache system (update it just once a week or something)
    - Possibly optimize code

    Unfortunately I'm not a great PHP coder, so I'm a bit stuck. I can post the code if its necessary, but if anyone could help me with some form of simple cache system that would help out, I would greatly appreciate it.

  2. #2
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    delete all users. it should work like lightning then.



    NOTE: I'm kidding.

  3. #3
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like a database optimization problem not a PHP problem, unless you are doing executing a large amount of PHP code when each row is returned. You might want to try posting the database schema and SQL to the Databases Forum and see if they can help you. Typically slow queries are because columns are not indexed, the SQL is poorly written, the database is not properly configured or the server is too slow for the application.
    Christopher


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •