Multiple language text in Mysql db or filesystem?

Discussion in 'Databases' started by Salami1_1, Sep 29, 2009.

  1. #1
    Hello,

    Currently my website has a multiple language system which is based on a MySql database (all text is retrieved in 1 query and then put in an array which is carried over in a SESSION to prevent having to re-query the db on every page). Now I've had the advise to switch from a MySql database system for my multiple language functionality to a file based system which should be faster but I was always under the impression that reading files using php is slower then getting it from a database..

    What is your advice / experience with this?

    Thank you.

    Best regards,
     
    Salami1_1, Sep 29, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Depends on the volume and how the database is being accessed. For very simple situations, a file based storage may be a better match. Generally if you're comparing storing hundreds of files to hundreds of database entries, the database should greatly outperform the file storage in most situations.

    I always lean towards keeping everything in a database. The only exception is actually storing files or other BLOB/TEXT data types. These can have major affects on a database's usability and are very often more appropriately handled by a file system.
     
    jestep, Sep 29, 2009 IP
  3. ohteddy

    ohteddy Member

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #3
    I tend to store translations on disk rather than in a db, since I usually need
    to hired a 3rd party to do the translations for me and I do not like to give them
    access to my database, nor do I like to have to manually add translations to the
    db. Too much room for error. Also, if you have a testing framework in place you
    can catch small errors i.e. missed translations, before committing code.

    You are doing the right thing by caching the language text, not sure I'd stick it
    in a session var tho, doesn't that mean it's stored once per user? If you have
    a lot of users that could eat up memory.
     
    ohteddy, Sep 29, 2009 IP
  4. Salami1_1

    Salami1_1 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hi,

    thanks for the answers. Good point on the caching per user.. that is actually what is happening now. I'm going to look into this. For now I do think I'll keep it in DB with file caching :)

    B.r.
     
    Salami1_1, May 9, 2011 IP