|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-05-27 10:22 UTC] adam at morrison-ind dot com
  [2009-05-28 05:24 UTC] abhargav at in dot ibm dot com
  [2009-05-28 16:28 UTC] adam at morrison-ind dot com
  [2021-08-23 14:40 UTC] cmb@php.net
 
-Status:      Open
+Status:      Feedback
-Assigned To:
+Assigned To: cmb
  [2021-08-23 14:40 UTC] cmb@php.net
  [2021-09-05 04:22 UTC] pecl-dev at lists dot php dot net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
Description: ------------ Selecting a BLOB from the database is VERY slow. Performing the same select with the old ifx_ API or using a JDBC app very quick. PDO and ifx_ compared on 5.0.4 since ifx_ API isn't enabled on current PHP build. Reproduce code: --------------- <?php class Test { public $db = null; public function connect($autoCommit=true) { $this->db = new PDO("informix:database=miecr;server=BARNET;", "adam", "**********"); return $this->db; } public function runTest() { $this->connect(); $stmt = $this->db->prepare( 'select wds_blob_id,wds_blob from wds_store where wds_blob_id = 11392' ); $stmt->bindColumn( 'WDS_BLOB_ID' , $id ); $stmt->bindColumn( 'WDS_BLOB' , $blob , PDO::PARAM_LOB ); $rs = $stmt->execute(); while ($stmt->fetch(PDO::FETCH_BOUND)) { var_dump( $id ); var_dump( $blob ); $fp = fopen( dirname(__FILE__) . "/large_blob_out.dat" , "wb" ); echo "datalength: " . stream_copy_to_stream( $blob , $fp ) . "\n"; system( "diff large_blob.dat large_blob_out.dat" ); } print "done\n"; } } $testcase = new Test(); $testcase->runTest(); ?> Expected result: ---------------- Would load a 3.5Mb BLOB in less than 42 seconds! Graphing the communication between the web server and the DB servers shows that throughput rapidly falls off. Actual result: -------------- yannigan-red:~ # time php -f blobPerfTest.php string(5) "11392" resource(4) of type (stream) datalength: 3591751 done real 0m46.065s user 0m0.044s sys 0m0.416s