php - Flat file vs MySQL for very simple data -
php - Flat file vs MySQL for very simple data -
from pure performance standpoint improve storing simple info (predefined messages). it's more work open file handle, json_decode "subject" , "body", , close file or query database (select subject
, body
predefine
id='message1' assuming id primary key). have 5-10 predefined messages want assume hundreds of users may using application concurrently.
reading flat file extremely fast little files... performance advantages of databases come when effort seek specific data. if you're grabbing specific file (say, based on filename: msg_1.txt
, msg_2.txt
, etc) you're going improve off flatfile system.
that said, jb nizet has pointed out, if you're dealing few messages don't bother... utilize constant or create array in php file can include_once()
ed when need definition:
$msg = array( 'msg1'=>array('sub'=>"subject",'body'=>"body text"), 'msg2'=>array('sub'=>"subject 2",'body'=>"body text 2"), //...etc. );
php mysql flat-file
Comments
Post a Comment