ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been working on a little content managment system for a small site. It's pretty much just a test of ideas. Very basic stuff, login, post a message, message appears on main page, etc. What i've been thinking about is what the better *setup* would be.
Either keep all the required data (user name, the block of text, etc) in database.
Or
Keep only some of the data in the db, while the possibly big blocks of text will be stored as seperate files (storing the name of the file in the db).
So what do you guys think? Advice, opinions are all welcome!
Putting all of your data in a database has the advantage of allowing you to control user access using the database's security mechanism instead of relying on lame *nix filesystem permissions. Definitely a better security model.
Given the choice between flat files and a database I almost always choose the database. If you do flat files you'll have to write all the code for querying, modifying, and adding data to the flat files... something the database does quite nicely for free. No sense in re-inventing the wheel.
I was just think of the character size for the text to store. In the db i'd need to cap it, while if i store the text in a flat file i can make it any size, yet that would mean writing my own functions for modifying those files.
I was just think of the character size for the text to store. In the db i'd need to cap it
not true, on MySQL the TEXT and BLOB datatypes can be enormous, i think the total maximum is 4GB but in practice it is less than this, but still massive. certanly larger than anyone will type as a message.
I was just think of the character size for the text to store. In the db i'd need to cap it, while if i store the text in a flat file i can make it any size, yet that would mean writing my own functions for modifying those files.
If your concern is the physical size of the resulting
tables then I can give you some good & friendly
information (at least if the data base in question
is postgres, don't know how mysql handles that).
In PostgreSQL blob's and other large objects
aren't stored in a table consuming vast amounts
of storage for non-allocated data. Rather, PG puts
a flat file in the filesystems, and stores access
parameters to it in the data base table :)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.