Re: Storing serialized data to DB

From: Date: Fri, 30 Dec 2005 20:34:58 +0000
Subject: Re: Storing serialized data to DB
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228044@lists.php.net to get a copy of this message
On Tue, December 27, 2005 7:11 pm, Sumit Chachra wrote: > Not very php specific so please pardon me if I am posting in the wrong > forum. > > I have a chunk of data which I am trying to cache. I serialize this > data > using the serialize() function in php. I am wondering what would be a > good > attribute type in my DB to store such (potentially long) strings? Some > types > have 4000 character limits and hence I get JDBC exceptions. I am using > Oracle DB. My first answer would be: Don't put it in the database. Throw it in /tmp or a disk file somewhere and put the file path into the database. If you HAVE to put it in the database, then you'd better: 1. Determine the MAXIMUM size of the serialize($chunk) of data. 2. Double that. 3. Find a data type in your database that is BIGGER than that. 4. The only answer is probably a BLOB. Internally, the database engine is most likely storing the BLOB as a separate file anyway, and you're getting very very very little gain out of putting it into the database. See first answer. :-) -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#228044) next »