Text File vs Database reading performance

Discussion in 'PHP' started by jimmy4feb, Apr 8, 2010.

  1. #1
    Hello Dp members,

    I have a database driven website & I want to improve its performance so that pages can load quickly at client side. So i think I can use text files instead of database & I will update text files as well with programming if I will update my database from admin session. It means text file will remain same as database all the time or I will just not use database any more. I will only work with file system. But before doing this I have couple of questions regarding file system vs database system performance.

    1. If I read data from text file or XML file instead of database tables, Will it give any positive effect to my website performance ???

    2. Like Databases have limited number of connections that number of limited users can access the database at same time.So is there any same type of limitation on accessing text files or XML file which are located on hosting server ???

    3. Which type of programming language (server-side programming language such as PHP or client-side programming language such as JAVASCRIPT) will be best to access the text file or XML file (which is located at hosting server) so that it can take maximum performance ???

    4. If I will access data from file instead of database then will I able to protect my data from to be copied and what type other hacking issues may rise ???

    Thanks for your valuable time,

    Jimmy
     
    jimmy4feb, Apr 8, 2010 IP
  2. Sergey Popov

    Sergey Popov Peon

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    1. If your database driven website uses database only to populate static content to pages, yes you can replace database with text files. But if you're using queries (like search), then it is best to use database. Just curious - what make you think that your database is not performing good? Maybe you just need to index tables?
    2. Usually there is limitation set by hosting provider on number of files opened at one time.
    3. I would recommend PHP, but it depends on functionality what you need on your website.
    4. You can protect your text files by keeping them in a directory not readable from web (you can use .htaccess to restrict access to that directory, or just store files in the directory outside
    your web root). On the server side, using PHP you can read these files and populate content to web pages.
     
    Sergey Popov, Apr 8, 2010 IP
  3. jimmy4feb

    jimmy4feb Peon

    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you sergey.... The information you provided is really very helpful....

    I appreciate, Thanks once again
     
    jimmy4feb, Apr 9, 2010 IP
  4. David3

    David3 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Isn't it true that databases get stored more in memory and thus faster?
     
    David3, Apr 9, 2010 IP
  5. David3

    David3 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Nevermind previous question -- I guess it depends on the size of the database, speed of server, how often data is accessed and thus put into cache, and a whole bunch of other variables.
     
    David3, Apr 11, 2010 IP