Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Database vs Flat File Performance Question

    I am working on a chat room in php. The key issue naturally is minimizing the data passed on each refresh (which can be aided by client side handling). But apart form that, is there likely to be any performance edge in using a database or a flat file? The assumption here is that I would keep only the last 50 to 100 messages in the flat file, and that I am doing a destructive write to the flat file each time - i.e., it gets compeltely rewritten each time there is input.

    G

  • #2
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Databases will definetly be faster in most cases.

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Databases will definetly be faster in most cases.

    Why? Because there's more overhead?I completely don't get this.
    Also don't quite get the flatfile idea (to me, a flatfile is a table). Think a regular textfile or a simple XML file would do the trick just fine.

    If you'd use MySQL4, you probably could use the query-buffer function, but that looks like complete overkill to me.

  • #4
    Registered User
    Join Date
    Feb 2003
    Location
    Berkshire, UK
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Database vs Flat File Performance Question

    Originally posted by gorilla1
    i.e., it gets compeltely rewritten each time there is input.
    can't u append to the file instead?

    i see no reason why a flat file couldn't match the speed of a database in this case.

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    with a flatfile, how would you get around the problem that multiple lines may need to be written at the same time? Sure, lock the file, but then the others will be lost...

    I would prefer the database route.

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Database.

    Before I got a database, I saw no reason for needing one, now I have a database, I wouldnt not use it!

    Just refresh part of the page aswell. Have you considered a flash room. I dont know what they are like on bandwitdth, but they run pretty smooth.

    Matt

  • #7
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just for the record, flatfile databases are based off of text files


  •  

    Posting Permissions

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