0

For us, it is very important to get high response time for our website php script which queries a large database. It is essentially getting user information for the user who visited the page. There may be millions of users in the db.

We would like to not bother using the user data at all if the record is not already in the InnoDB Buffer Pool of the MySQL database, and use information only if present in the above cache.

Is there a way to directly ask Mysql/InnoDB whether the record is in cache?

We thought this might have been addressed by many others when developing high performance web apps. Is it not common to get data only if can be retrieved in super quick time (for some scenarios at least where response time is very critical) and not otherwise?

  • Didn't you ask this somewhere else? – Rick James Jun 2 '18 at 3:47
  • yes on dba. but there was no reply and we were really in tight situation – Gurpreet Singh Jun 2 '18 at 7:05
  • Even it if were implemented, it might take so much time to do the check that the overall system would be slowed down. I hope you are not using UUIDs; they are terrible. – Rick James Jun 2 '18 at 14:43
1

There is no built-in mechanism to query the MySQL cache without causing MySQL to bring the row into memory from disk if it is not already in memory.

You might want to consider using a caching layer between your website and the database. Stack Exchange uses Redis; you may want to evaluate that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.