How can I determine when an InnoDB table was last changed?

后端 未结 3 738
攒了一身酷
攒了一身酷 2020-12-10 13:52

I\'ve had success in the past storing the (heavily) processed results of a database query in memcached, using the last update time of the underlying tables(s) as part of the

3条回答
  •  庸人自扰
    2020-12-10 14:33

    This is MySQL bug 14374, 15438, and underlying InnoDB bug 2681.

    I have two suggestions (other than patching MySQL).

    1. If you're using one table per file (innodb_file_per_table), stat the underlying file. You could write a MySQL function/extension to do this. This may lag slightly, due to database caching.
    2. You can use after update, delete, and insert triggers to keep your own metadata table with the last update times for each table you're concerned with.

    I'd personally suggest the second, as its much more portable and doesn't depend on implementation details (such as innodb_file_per_table).

提交回复
热议问题