MySql:了解表的最后修改日期
我在 MySql 中使用 InnoDB 引擎,我试图弄清楚是否可以知道上次修改表的日期时间(无论是数据还是结构)。
由于它是 InnoDB,我无法在 information_schema
.Tables
中使用 column update_time
,因为那里没有记录任何内容。无论如何,带有大量数据的 information_schema
的性能都很糟糕,所以没有太大损失。
我想过使用一个触发器,在进行修改时将日期插入到自制的“元数据”表中,但是MySql不支持DDL触发器(Create、Alter和Drop语句),所以这也行不通。
我有点没有想法了,有什么建议吗?
谢谢
编辑:我忘记指定我正在开发的 Silverlight 应用程序将检索此日期时间数据(通过 Web 服务)。
提供更多背景信息:我的 Web 服务上有一个方法,它返回数据库的结构及其数据。根据大小,这可能是一个相对较长的操作,因为我必须在 information_schema
表中获取外键信息。所以我只想在数据或结构发生变化时查询数据库。
I'm using a InnoDB engine in MySql and I'm trying to figure out if it is possible to know the datetime of the last time a table was modified (be it it's data or it's structure).
Since it's InnoDB, I cannot use the column update_time
in information_schema
.Tables
as nothing is logged there. The performance of information_schema
with a lot of data is crappy anyway, so no big lost.
I thought about using a trigger that would insert the date in a self-made "metadata" table when a modification is made, but MySql doesn't support DDL triggers (Create, Alter and Drop statements), so this won't work either.
I'm kinda running out of ideas here, any tips?
Thanks
Edit: I forgot to specify that this datetime data will be retrieved (via a web service) by a Silverlight application I'm developing.
To give more background: I have a method on my web service that returns the structure of a database, with its data. Depending on the size, this could be a relatively long operation since I must get foreign key information in the information_schema
table. So I want to query the database only if the data or structure as changed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建触发器来使用审计跟踪,
记录时为表示例
好的,您可以通过在插入
更新表的
在谷歌上的审计跟踪上进行一些搜索以获取更多详细信息
Ok you can use audit trail by creating a trigger for a table
example
when inserting recored
for update tabel
do some search on audit trail on google for more details