0

According to the mysql 5.6 docs:

A query also is not cached under these conditions: ... It refers to user-defined functions (UDFs) or stored functions.

However, I have seen claims that if the UDF is completely deterministic, the query can in fact be cached. Can someone confirm or deny that? If indeed UDFs do prevent caching, is there any smarter way to allow the queries to be cached than to simply inline the UDF into each query? (That would work, but would obviously be cumbersome.)

Edit: Also, is the behavior different for stored functions vs user-defined functions written in C?

asked May 29, 2014 at 5:04

1 Answer 1

1

Based on some experimentation with MySQL 5.5.33, the answer is "no". I have a function definition which is deterministic (it's a simple date calculation) and is marked as DETERMINISTIC. If I use it in a query, the query is not cached. If I replace the call by its definition in terms of the built-in date_sub() function, the query is cached.

answered Mar 2, 2015 at 20:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.