I have a table with a boolean value, if that value is not explicitly set to anything in the database for a few minutes by the back-end (django) then it must automatically be set to false. How do I do that in MySQL efficiently?

  • Could you please elaborate on what do you mean by 'if the value is not set to anything for a few minutes'? What flavour and version of MySQL are you using? – Károly Nagy Jul 15 '16 at 11:08
  • I have modified the question, and there is no constraint on flavor and version of MySQL. – Ranbir Jul 15 '16 at 11:11

You should use the MySQL event scheduler to run a a query to update all rows where the age of the row is greater than your threshold and have it execute the update at a suitable interval.

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.