More robustness to mysql functions, with timeout