PHP Database Queries

Discussion in 'PHP' started by Python, Jul 25, 2007.

  1. #1
    Im currently working on a project which is quite large. On one of the pages its currently running 8 SELECT queries. I know this isn't a huge amount but what would be an estimate on the limit?

    If this page was to receive 5,000 uniques per day would it be OK to run this many queries without any trouble?
     
    Python, Jul 25, 2007 IP
  2. jazz7620

    jazz7620 Banned

    Messages:
    357
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It depends on how well are your columns indexed. You can probably use joins to create a sql which could eliminate a few queries, it all depends upon your database design.

    If you are in shared hosting environment, it does not really matter how many unique do you get. The database can be hosed by someone else.

    If you provide more details, I can help you writing optimized query/queries.
     
    jazz7620, Jul 25, 2007 IP
  3. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #3
    What DB server do you use ? Mysql/MSSql?
     
    gibex, Jul 25, 2007 IP
  4. Python

    Python Well-Known Member

    Messages:
    680
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    120
    #4
    @jazz7620 - The database' structure is all in 3NF so its laid out quite logically. Right now the page is at 8 queries however I know I could combine 3 of these together (all are based around user accounts) to end up with 6 queries. But because of the data being pulled theres no way for me to join or combine any more. And yes I am on a shared server right now but am considering moving to either a VPS or dedicated when I launch this site.

    @gibex - MySQL

    Thanks
     
    Python, Jul 25, 2007 IP
  5. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #5
    With that number of visitors, I would go to a dedicated just so you have control and room to go. A decent server shouldn't have much problem with that volume.

    Also, if the pages aren't unique to each user, you could look at some sort of caching which would really lighten up the load on the database.
     
    jestep, Jul 25, 2007 IP
  6. Python

    Python Well-Known Member

    Messages:
    680
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Ok thanks for your help.
     
    Python, Jul 25, 2007 IP