News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

David Goodwin's Blog:
Storing PHP objects in a database (please no!)
March 13, 2009 @ 12:01:36

David Goodwin has a suggestion for those developers that think storing objects in a database is a good idea - don't do it!

Short answer: DO NOT DO IT. Longer answer:....I hate seeing serialized PHP objects within a database.

Some of his reasons include:

  • It's difficult to index/search - you'll probably need to use a regexp.
  • PHP Specific - good luck doing much with the data in a.n.other language
  • If the objects are large, you're likely to have a text or a blob field - this will suck from a performance point of view (at least in MySQL)
  • Why bother storing serialized objects in a database - surely to the filesystem would be better?

Several opinions are expressed in the comments including some that agree with David and some that still defend the idea.

0 comments voice your opinion now!
serialize database object store opinion against


blog comments powered by Disqus

Similar Posts

DevShed: The Basics of Serializing Objects in PHP

Christian Schaefer's Blog: Beware of the timezone! Working with PHP DateTime & Doctrine for MongoDB

Jani Hartikainen's Blog: Common programming errors and how to avoid them

Jani Hartikainen's Blog: Unit testing 4: Mock objects and testing code which uses the database

Ralph Schindler's Blog: Composite Rowsets For Many-To-Many Relationships Via Zend_Db_Table


Community Events





Don't see your event here?
Let us know!


bugfix install interview series podcast api community list unittest laravel configure language threedevsandamaybe developer code release library wordpress introduction application

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework