Suggest an editImprove this articleRefine the answer for “What is a deterministic function?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **deterministic function** is a function that **always returns the same result for the same input**: it **doesn't depend on external factors**, such as the current time, random numbers, or database state, e.g. `add_ten(5)` always returns `15`. **Key point:** deterministic functions can be **cached and optimized**, unlike non-deterministic ones (`RAND()`, `GETDATE()`), whose result is unpredictable.Shown above the full answer for quick recall.Answer (EN)ImageA **deterministic function** is a function that **always returns the same result for the same input**. It **doesn't depend on external factors**, such as the current time, random numbers, or database state. ### Example of a deterministic function ```sql CREATE FUNCTION add_ten(x INT) RETURNS INT AS BEGIN RETURN x + 10; END; ``` Calling `add_ten(5)` **always** returns `15`. And here's an example of a **non-deterministic** function: ```sql SELECT RAND(); -- a random number SELECT GETDATE(); -- the current time ``` Every call gives a different result, even with the same arguments. ### Why this matters - Deterministic functions can be **cached** and **optimized**. - Non-deterministic ones **can't**, since the result is unpredictable.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.