Deterministic function in mysql

后端 未结 5 1494
野性不改
野性不改 2021-01-03 18:27

I got confused with a seemingly simple concept. Mysql defines deterministic function as a function that

always produces the same result for the same

5条回答
  •  暖寄归人
    2021-01-03 19:00

    You're not missing anything. This function is non-deterministic. Declaring it deterministic won't cause your database to melt but it might affect performance. From the MySQL site: "Declaring a nondeterministic routine as DETERMINISTIC might lead to unexpected results by causing the optimizer to make incorrect execution plan choices." But MySQL does not enforce or check if your declared deterministic routine is actually deterministic---MySQL trusts that you know what you are doing.

提交回复
热议问题