[dev] TEXT vs. BLOB in postgres for VFS?
Michael M Slusarz
slusarz at horde.org
Wed Oct 29 23:05:41 UTC 2008
A client just brought this to my attention: using VFS storage for IMP
attachments with Postgresql results in massive memory usage that
quickly exhausts available memory. A 7 MB attachment is causing 150+
MB to be allocated. Tracing the code, everything looks good until
VFS_sql::_writeBlob(). The code uses only ~12 MB until the bin2hex()
call to convert binary -> text for postgres on the data. This causes
memory to balloon to 26 MB+. Then PEAR DB does a fantastic job of
just murdering memory usage after that (I have no idea what it is
doing).
But I don't see any reason why we need to use a TEXT field here.
Postgres supports a BLOB field, and that field would remove the need
for the bin2hex() call (and the resulting pack() call when unpacking).
Can't find anything in the archives why this choice was made. Since
I'm not the DB expert here, can anyone else clue me in? Or is this a
relic from the days when postgres lacked proper BLOB support?
michael
--
___________________________________
Michael Slusarz [slusarz at horde.org]
More information about the dev
mailing list