We started using statement-based replication, and found that it breaks SQL_CALC_FOUND_ROWS and FOUND_ROWS(), and I’m looking for a work around. A comment from a bug report in 2007 suggests using SELECT SQL_CALC_FOUND_ROWS INTO @found_rows FROM foo, but that doesn’t seem to work. MySQL says the syntax is invalid.
We started using statement-based replication, and found that it breaks SQL_CALC_FOUND_ROWS and FOUND_ROWS(), and
Share
If you’re using an older version of MySQL, that could be part of your problem: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_found-rows
Edit: The above only works if you’re in
MIXEDmode.Also, the correct workaround syntax is:
SQL_CALC_FOUND_ROWSdoesn’t return anything, it just tells MySQL to calculate the number of found rows from the query, even if aLIMITclause prevents all of them from being returned to the client.FOUND_ROWS()can then be used to return the value that was temporarily stored bySQL_CALC_FOUND_ROWS.Edit: The idea behind the above workaround (as documented in MySQL bug 12092):