简体   繁体   中英

Store data in database or files?

I have some doubts, im developing a web application in GWT using MVP model. Let assume that im implementing a forum,so users could post comments, im wondering how to keep this data?

For example,a post could have 2000.. 3000 chars, im thinking about files.. every category has it own posts, so i could store category per file.. Or other idea is to hash the data..

I would be glad to know more opinions and approaches..

Thanks guys.

Edit.

I see from the comments that database is the right decision, but should i insert the posts direct or do rework it somehow and then insert?

Database. Without options.

Moreover, database provides a much easier way to search, index and extend the data without any limits. For example if you decide that each post can have it's smiley face - it is a question of 1 extra column in database. However with files it will become a real pain to convert all files to new format.

Also, what about relative data? As @The Elite Gentlemen mentioned, storing relative data in files is also painful. Yes, you will index the posts in categories by directory names, but how will you save the Author of the post? Link to his profile? Number of posts the author has or his avatar?

In your place I would not to place the data in files. For a simple reason - you once again write another database. What's more if you use files, you will need time to keep this system. Databases is checked and tested, so you have need less time for maintenance. In the case of a forum you consider multi-level the cache.

First level in database - ex. using for some table memory (but with risk), procedural language in database, and standard tools as index etc.

Second level in http - if you using gwt, you may cache threads from forum. For this you don't need gwt mechanism, only need special server configuration.

Third level - this is gwt/javascripts - in gwt browse client level, you may keep newly created forum threads.

just enough to quickly...

Saving data in files will cause run-time error because of CPU overloading.USing datbase is the only way actually

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM