Advance PHP prog. I need an advice.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • qw12er
    Confirmed User
    • Apr 2004
    • 799

    #1

    Advance PHP prog. I need an advice.

    Will it be faster to dump data into a file than in a Database ?

    Thanks
    I have nothing to advertise ... yet.
  • psili
    Confirmed User
    • Apr 2003
    • 5526

    #2
    I'd think a DB would be faster since it supports multiple connections where as a file you have to deal with I/O resource constraints.
    Your post count means nothing.

    Comment

    • Spudstr
      Confirmed User
      • Jan 2003
      • 2321

      #3
      flat file would be faster, even though your still using multi connections your still using a wrapper to get to the database. still using a wrapper to use the file... i sitll think flat file will be faster
      Last edited by Spudstr; 02-19-2005, 06:59 AM.
      Managed Hosting - Colocation - Network Services
      Yellow Fiber Networks
      icq: 19876563

      Comment

      • MickeyG
        Confirmed User
        • May 2004
        • 4134

        #4
        i believe its faster to write to but not read from.

        Comment

        • qw12er
          Confirmed User
          • Apr 2004
          • 799

          #5
          I'd say flat file would be faster ... but I never saw benchmark ... anybody have a URL ?
          I have nothing to advertise ... yet.

          Comment

          • Spudstr
            Confirmed User
            • Jan 2003
            • 2321

            #6
            file is faster to write/read from.. just don't go searching through it ;-)
            Managed Hosting - Colocation - Network Services
            Yellow Fiber Networks
            icq: 19876563

            Comment

            • qw12er
              Confirmed User
              • Apr 2004
              • 799

              #7
              HAHAHAHA Don't worry I'm not such a dumb ass
              I have nothing to advertise ... yet.

              Comment

              • woj
                <&(©¿©)&>
                • Jul 2002
                • 47880

                #8
                It's not hard to do your own benchmark, just loop through 1000s of inserts to a flat file and then database (probably open and close connection between each write). It's not exactly accurate, but will give you a rough idea.
                Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                Comment

                • psili
                  Confirmed User
                  • Apr 2003
                  • 5526

                  #9
                  Since everyone is saying the file - what happens if it's a high transaction load and you have to maintain locks on the file to ensure data integrity; wouldn't you hit a open / write / close limit as opposed to a database that can handle multiple at the same time ?

                  Seriously, I'd like to know as well.
                  Your post count means nothing.

                  Comment

                  • onlyreal
                    Confirmed User
                    • Jun 2001
                    • 853

                    #10
                    as long as you dont search

                    files

                    but for example password username matching is also searching

                    one more thing moving in files s always hard pointers etc db rulez

                    Comment

                    • Calvinguy
                      Confirmed User
                      • Oct 2002
                      • 1752

                      #11
                      DB access is always faster than a flatfile. Especially if you use the querycache function in mysql 4+

                      Comment

                      • Spudstr
                        Confirmed User
                        • Jan 2003
                        • 2321

                        #12
                        well he asked if it would be faster to dump data to a file or a db.. DUMp keyword if your reading it over and over.. db is the way to go.. just depends on what he's trying to do..
                        Managed Hosting - Colocation - Network Services
                        Yellow Fiber Networks
                        icq: 19876563

                        Comment

                        • qw12er
                          Confirmed User
                          • Apr 2004
                          • 799

                          #13
                          I just thougt - How can the DB be faster ?

                          Database will ultimately result into a write command to a flat file + all the operations to connect and interprate the command. So all the writting operation + some other...

                          So it's quite sure files are faster ... the question now is will writting to files result in a file lock situation resulting into lag time ?

                          A good way to avoid this would be to create a file everytime ... but I'm not sure this is the way to go ... Cause my system won't work in real time and I'll have to use a cron table to update my database everyday ...
                          I have nothing to advertise ... yet.

                          Comment

                          • psili
                            Confirmed User
                            • Apr 2003
                            • 5526

                            #14
                            I was only thinking of this in terms of transaction load: Access to a file can only happen with one connection (write) at a time, but a DB can handle multiple connections (writes) at the same time as it's threaded. It's Saturday morning though, so I could be retarded and am thinking of this entirely wrong.
                            Your post count means nothing.

                            Comment

                            Working...