Optimal way to store data?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
daou
Forum Newbie
Posts: 8
Joined: Sat Jun 10, 2006 12:53 pm

Optimal way to store data?

Post 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)?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

A few thousand characters is not a lot. Just use TEXT.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post 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 :)
Post Reply