Welcome Guest, Not a member yet? Register   Sign In
Unusual slowdowns with CI's Oracle driver
#1

[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?




Theme © iAndrew 2016 - Forum software by © MyBB