Page 1 of 1

Optimal way to store data?

Posted: Sat Jun 10, 2006 1:08 pm
by daou
I am using PHP with MySQL. My situation is this:
I need to store a large amount of little data for lots of users. Ok, store them in MySQL.
But I also need to let them store very long strings with as little restrictions in the text as possible.

I thought I could dodge most of the security issues involving MySQL and unrestricted strings by saving the large strings in text files, and reducing the size of the database at the same time.

Now am I just being dumb by not saving the strings in MySQL (possibly a few thousand characters to just a couple characters each)? Or if saving the strings in text files is the way to go, should I save them in multiple text files (and end up with possibly thousands of them) or fuse them into one big text file with delimiters (and load the server with parsing functions each time a single entry is requested)?

Posted: Sat Jun 10, 2006 1:15 pm
by Ambush Commander
A few thousand characters is not a lot. Just use TEXT.

Posted: Sun Jun 11, 2006 3:51 pm
by alex.barylski
Like AC said...a few thousand characters isn't really a big deal...however...

It's unwise to store large amounts of data inside a frequently accessed table...so do something like:

users:
=====
pkid, fname, lname, age, sex

users_info:
========
pkid, sig, bio

users_info table could be a file in which case the file should be named according to the PKID of users table (123.txt) os some similiar convention.

users PKID should be auto-increment and users_info PKID should be set to whatever users PKID is. Saves you the trouble of adding a FKID (foreign key ID).

Cheers :)