We have a laravel 4.1 application that used to run under PHP 5.4, however since upgrading to 5.6.13 (And today to 5.6.14) I've noticed that queries have started to sometimes return 0 for FOUND_ROWS()
. On some of our queries it seems to be intermittent, however on others it's more of a permanent issue.
The biggest impacted sets are those with sub queries.
We're using PDO (we're not using the laravel models, just interacting directly with its PDO object). MySQL hasn't been modified in this time frame either.
Tried all sorts - one suggestion was to set trace mode to 0, that didn't help though. I tried setting PDO::MYSQL_ATTR_USE_BUFFERED_QUERY
to false, however that leads to a PDO error when you try and select FOUND_ROWS()
(Can't get the exact message right now).
Short of rolling back to 5.4 (please God no), I'm completely stuck...
Running these queries directly in MySQL, and then running FOUND_ROWS()
always returns the correct results.
New Relic Application has some issues. NewRelic Application Monitoring Daemon or extension is interfering with the results of FOUND_ROWS()
The current workaround is =>
newrelic.transaction_tracer.explain_enabled = false
It's not clear yet what your sql PDO queries are. Still trying my way of using FOUND_ROWS()
with PDO. Check if you are using same way or please provide some queries your are trying.
$db = new PDO(DSN...);
$db->setAttribute(array(PDO::MYSQL_USE_BUFFERED_QUERY=>FALSE));
$rs = $db->query('SELECT SQL_CALC_FOUND_ROWS * FROM table LIMIT 5,15');
$rs1 = $db->query('SELECT FOUND_ROWS()');
$rowCount = (int) $rs1->fetchColumn();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With