ocaml-mysql icon indicating copy to clipboard operation
ocaml-mysql copied to clipboard

Setting MAX_EXECUTION_TIME returns fewer results but no error

Open Leonidas-from-XIV opened this issue 7 years ago • 3 comments

We were wondering why we sometimes get less than our LIMIT 100 results on our queries, even though the should still have been more results. This is important because we paginate through a big dataset and would like to detect the fact when we reached the last page (which would be signalled by returning less then LIMIT results).

As it turned out this is due to our setting of SET MAX_EXECUTION_TIME=10; to limit the execution time of our queries, which correctly causes timeout errors in MySQL clients (error code 3024) but not with this library. Instead ocaml-mysql returns fewer results without any obvious indication (like an exception) that the underlying query actually failed.

Is there a way to make this library signal errors when this problem happens?

Leonidas-from-XIV avatar Apr 09 '18 14:04 Leonidas-from-XIV

Sounds like a bug. Patch is welcome..

ygrek avatar Apr 20 '18 12:04 ygrek

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_execution_time I cannot find any mention what happens to query result if timeout is reached (I would expect error returned with no results), are you sure max_execution_time is the reason of result set truncation?

ygrek avatar Nov 12 '19 17:11 ygrek

This error goes away if we don't set it. If we set the execution time limit on a 3rd party client like Sequel Pro, we are getting an error message that the execution time limit was reached.

Leonidas-from-XIV avatar Nov 12 '19 18:11 Leonidas-from-XIV