MySql 中的 @@DBTS

发布于 2024-07-13 04:37:46 字数 175 浏览 3 评论 0原文

大家好,我想问一下MySql中是否有相当于@@DBTS TSQL全局变量的变量(我需要访问整个数据库中已访问的最后一行的时间戳,而不仅仅是一个表)。

我需要这个,因为我正在尝试使用 Microsoft Sync Framework 和 MySql 进行双向同步。

任何帮助都感激不尽。 谢谢。

Hey guys, I want to ask if there is an equivalent to the @@DBTS TSQL global variable in MySql (I need to access the timestamp of the last row that has been accessed in the whole database, not just one table).

I need this because I'm trying to use Microsoft Sync Framework and MySql for bi-directional syncing.

Any help will be much appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪花飘飘的天空 2024-07-20 04:37:46

据我所知,您可以获得的最接近的是这样的查询:

USE INFORMATION_SCHEMA;
SELECT MAX(UPDATE_TIME) FROM TABLES WHERE UPDATE_TIME < NOW();

INFORMATION_SCHEMA 数据库包含数据库中所有表的属性的多个表。 WHERE UPDATE_TIME <的原因 NOW() 子句的特点是,只需运行该查询,就会导致 MySQL 更新 INFORMATION_SCHEMA 中的一些表,因此如果没有 WHERE 子句,您将总是只获取当前时间。

显然,如果你的 MySQL 数据库真的很忙,所以所有表基本上每秒都会更新,那么这个查询将不起作用,但在这种情况下,你最好尽可能频繁地同步,因为你知道会有修改。

The closest you can get, as far as I know, is a query like this:

USE INFORMATION_SCHEMA;
SELECT MAX(UPDATE_TIME) FROM TABLES WHERE UPDATE_TIME < NOW();

The INFORMATION_SCHEMA database holds several tables of attributes of all tables in the database. The reason for the WHERE UPDATE_TIME < NOW() clause is that simply by running that query, you cause MySQL to update some of the tables in INFORMATION_SCHEMA, so without the WHERE clause you'd always just get the current time.

Obviously, if your MySQL database is really busy, so that all tables are updated basically every second, this query won't work, but in that case you might as well just sync as often as possible because you know there'll be modifications.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文