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

Chris Jones' Blog:
Reducing Oracle LOB Memory Use in PHP, or Paul's Lesson Applied to Oracle
Mar 22, 2010 @ 18:49:51

Following along the same theme of Paul Reinheimer's suggestion of using unset to conserve memory usage, Chris Jones has applied a similar pattern to the world of Oracle+PHP.

In Oracle you might come across this situation when dealing with LOBS. Here's an example that selects an entire LOB into PHP's memory. I see this being done all the time, not that that is an excuse to code in this style. The alternative is to remove OCI_RETURN_LOBS to return a LOB locator which can be accessed chunkwise with LOB->read().

He includes an example of pulling out some large data from a table's CLOB fields showing some stats on the memory usage, both with and without an unset to handle the growing fetched data. The end result was a much lower memory usage overall (peak) and a mention of two other things that could help with the Oracle side of things - LOB->free() and the latest OCI8 extension that frees up LOB resources more efficiently.

tagged: memory usage optimize oracle lob benchmark

Link:

Christopher Jones' Blog:
Temporary LOBS in PHP's OCI8 Extension. Instant Client.
Jan 21, 2008 @ 18:05:00

Christopher Jones talks today on his blog about a bug he's just corrected and integrated into the release of the Oracle Instant Client that lets PHP correctly take advantage of the temporary LOBS functionality.

When PHP is done with the temporary LOB, it needs to tell Oracle to destroy it. If this isn't done, then the temporary LOB will hang around using DB space until the connection is closed. I just merged a fix worked on by Krishna Mohan and myself for bug 43497.

Example code is included showing two instances of its use - a normal use that frees the memory correctly and the other showing how to create the temporary lob to hold the data as needed.

tagged: temporary lob patch oci8 extension instant client memory leak

Link:

Maggie Nelson's Blog:
PDO_OCI does not support CLOBs
Jun 20, 2007 @ 19:07:03

After struggling with it for a good while, Maggie Nelson finally figured out the answer to her problems with Oracle, PDO and CLOBs - they're just not supported.

LOB support was added to PDO_OCI in PHP 5.1. This is really cool, however, it appears that the LOB support really means BLOB support. After much investigation and self-doubt (e.g. "what if we're using streams incorrectly?"), we found out that PDO_OCI does not currently support CLOBs (BLOBs only!).

The bug's already been documented and remains open, but Maggie encourages all of the Oracle developers out there with the fact that Chris Jones (of Oracle) knows about the issue and plans to correct it in the next release of the extension.

tagged: pdooci clob lob support bug datatype pdooci clob lob support bug datatype

Link:

Maggie Nelson's Blog:
PDO_OCI does not support CLOBs
Jun 20, 2007 @ 19:07:03

After struggling with it for a good while, Maggie Nelson finally figured out the answer to her problems with Oracle, PDO and CLOBs - they're just not supported.

LOB support was added to PDO_OCI in PHP 5.1. This is really cool, however, it appears that the LOB support really means BLOB support. After much investigation and self-doubt (e.g. "what if we're using streams incorrectly?"), we found out that PDO_OCI does not currently support CLOBs (BLOBs only!).

The bug's already been documented and remains open, but Maggie encourages all of the Oracle developers out there with the fact that Chris Jones (of Oracle) knows about the issue and plans to correct it in the next release of the extension.

tagged: pdooci clob lob support bug datatype pdooci clob lob support bug datatype

Link:


Trending Topics: