Jump to content


Photo

Content-in-MySQL, newbie question


  • Please log in to reply
3 replies to this topic

#1 aeris130

aeris130
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 22 February 2006 - 03:56 PM

I'm currently trying to learn about MySQL in order to get rid of about 350 php-files currently plaguing my host.

I've noticed that there's a lot of tutorials etc about storing contacts, passwords, etc, but I'm also interested in storing my entire content, including extensive articles.

So, first of all, how much space would be required for this? Also, are there any tutorials specifically regarding this, or can most tutorials about retrieving info from MySQL be applied?

In other words, is there anything special that I should keep in mind when storing extensive content, compared to names, phonenumbers etc?

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 February 2006 - 07:55 PM

Assuming you're just talking about text files (and not binary data), my recommendation would be to keep them in a separate table. TEXT/LONGTEXT fields are not fixed-width, so they may slow down queries on existing fixed-width tables. Otherwise, there's nothing special about storing 65K of text in one field vs storing 250 characters.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 22 February 2006 - 09:42 PM

You shouldn't have any problems storing HTML in the database, although storing PHP code is slightly more involved (if you want it to be executed when it comes out).

One of the nice things about storing articles in MySQL is you can use COMPRESS() and UNCOMPRESS() to transparently save space. Some MySQL installations may not have support for it though.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 February 2006 - 10:15 PM

True enough... again, it simply means a performance hit every time you want to access said article. Is space isn't an issue (which it usually isn't) and the space savings is minimal, they there's no need to bother in the general case.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users