Re: Storing serialized data to DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux