database optimization

Discussion in 'PHP' started by falco85, Dec 4, 2005.

  1. #1
    Hi,
    I'm projecting a script needing an admin approval for every submission made from the user.
    I was wondering what it was the most effective way to save server resources then optimize the script performance.

    First option
    Using the same database for approved/pending entries, with an approval field that would be a boolean variable. The admin script just changes that field from false to true.

    Second option
    Using two different DBs for approved/pending entries. The admin script when approving an entry would get the whole data from a database and would transfer to the other one.

    The first option would require a check of the approval field everytime somebody (the user) is viewing the entries, anyway it's only a boolean variable.

    what's the most effective way to do the job? thanks :)
     
    falco85, Dec 4, 2005 IP
  2. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #2
    #1. With indexing on that boolean field when necessary, the cost is minimal.
     
    TheHoff, Dec 4, 2005 IP
  3. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #3
    #1. Keeping all the values within the same database will make overall maintenance less than synchronizing between different DBs. IMHO
     
    North Carolina SEO, Dec 4, 2005 IP
  4. Michau

    Michau Well-Known Member

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #4
    If properly indexed on the Boolean flag, the two solutions will be almost equally efficient. But writing a script for the second one will be harder.
     
    Michau, Dec 5, 2005 IP