What is the difference between deterministic and non-deterministic function?
I was hoping that deterministic would make the DBMS find the function clean and cache its result?
DETERMINISTICnon-deterministic components. The values of the values, the result is the same. It can be aDETERMINISTICto add aDETERMINISTICto the declaration section. . This is a result of a previously calculated result.
Source
create function det() returns INTEGER DETERMINISTIC NO SQL return @param; create function ndet() returns INTEGER NOT DETERMINISTIC NO SQL return @param; select @param:=5, det() d1, ndet() n1 , @param:=3, det() d2, ndet() n2 , @param:=1, det() d3, ndet() n3 , @param:=7, det() d4, ndet() n4; Result:
5, 5, 3, 3, 3, 1, 1, 1, 7, 7, 7
Those. I do not see any difference.
How to understand what the difference is and in what situations it manifests itself?
DETERMINISTICcan be written to the binary log directly as an expression, andNON DETERMINISTICcan be written only asrow-based— otherwise, other data mayNON DETERMINISTICon the replica. - Anddeterministic functionis a synonym forpure function. Added a quote about Oracle to the question - vp_arth"синоним" в этом комментарии не является синонимом к "синониму" в томSTA ??? O_o I do not carp. Just you really contradict yourself. - PECHAIR