Results 1 to 3 of 3
  1. #1

    Most optimal file db for read-only.

    I'm writing an file based article "database" in PHP. I don't want to use a real database but still want to make read-only access as fast as possible even when there are a lot of articles. I have come up with two options:

    * Implement file access from scratch. I.e. Each article is stored in "ArticleDir/Article.txt". Simply use "fopen()" to open and read a specified article. I may also use "is_dir()" on the directory for some other purposes.

    * Use SQLite. An article would be retrieved by a select statement that uniquely identifies the article. (in SQLite the "database" is stored in a single file).

    My problem: How well does a file system with 1000's of files and directories scale compared to SQLite with only 1 file? In SQLite the article must be found somewhere within the database file which I guess will take some time. With 1000's of files I know the exact location of the article (ArtDir/Art.txt) but PHP in addition to the underlying file system(fat32 on winXp) maybe becomes inefficient when dealing with so many directories and files?

    My biggest concern is read-only access to a unique article so my main question is which of the two above options is the best for this purpose and why?

    Regards AnomalyE

  2. #2
    Why are you so averse to using a mysql database?

    I would opt for sqlite over flat files, personally.
    "The only difference between a poor person and a rich person is what they do in their spare time."
    "If youth is wasted on the young, then retirement is wasted on the old"

  3. #3
    Why are you so averse to using a mysql database?
    I want to be able to run it on servers without mySql support.

    I would opt for sqlite over flat files, personally.
    Ok, any particular reason? Since the whole database have to be locked when writing with SQLite I lean towards flat files at the moment... If there isn't any noticable advantage when using SQLite.

Posting Permissions

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