• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unusual slowdowns with CI's Oracle driver

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

$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:

$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);

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.