CodeIgniter Forums
Unusual slowdowns with CI's Oracle driver - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Unusual slowdowns with CI's Oracle driver (/thread-30029.html)



Unusual slowdowns with CI's Oracle driver - El Forum - 04-29-2010

[eluser]Rob Stefanussen[/eluser]
I'm experiencing a very unexpected behavior when using CI's Oracle driver with the DB class.

I'm running a stored procedure like this in CI:

Code:
$result = $this->db->query('select col1, col2 from table(stored_procedure(?, ?))', array($param1, $param2))->result();

The result takes ~15s.

Next I run the query like this:

Code:
$sql = 'select col1, col2 from table(stored_procedure(:param1, :param2))';
$stmt = oci_parse($this->db->conn_id, $sql);

oci_bind_by_name($stmt, ':param1', $param1);
oci_bind_by_name($stmt, ':param2', $param2);

oci_execute($stmt);
        
$result = array();
while ($row = oci_fetch_object($stmt)) $result[] = $row;

The query time is ~4.75s.

The actual times vary based on DB load, but doing the query manually is consistently about 3 times faster than running it through the DB class. I've spent some time in that class, and I know there's overhead that goes along with adding an extra layer, but 3x seems disproportionate, especially considering that this disparity is consistent despite varying DB load.

Does anyone know what's going on that would cause this?