Reputation: 6308
I am reading a MySQL tutorial and I encountered this :
SELECT /*! SQL_NO_CACHE */ user FROM users;
Why is the optimization hint SQL_NO_CACHE is enclosed with :
/*! */
I looked up on google but I simply failed to get any result.
Upvotes: 2
Views: 140
Reputation: 16834
The idea is to make the query more portable. That way, only MySQL will see it, not whatever language/connection-pool/driver you're using, trying to validate it, and failing, since it's not standard SQL.
Upvotes: 3
Reputation: 1179
These are hints to MySQL, like the one you mention, it says not to cache the result. These hints are written this way, so that they interpreted by MySQL only (try to run the query in another database).
Upvotes: 3