show status like'%backquery%'を実行します)。SELECT ... FROM <テーブル名>AS OF TIMESTAMP <時間>;
MySQL [test]> create table t1(id int,c1 int) engine=innodb;Query OK, 0 rows affected (0.06 sec)MySQL [test]> insert into t1 values(1,1),(2,2),(3,3),(4,4);Query OK, 4 rows affected (0.01 sec)Records: 4 Duplicates: 0 Warnings: 0MySQL [test]> select now();+---------------------+| now() |+---------------------+| 2022-02-17 16:01:01 |+---------------------+1 row in set (0.00 sec)MySQL [test]> delete from t1 where id=4;Query OK, 1 row affected (0.00 sec)MySQL [test]> select * from t1;+------+------+| id | c1 |+------+------+| 1 | 1 || 2 | 2 || 3 | 3 |+------+------+3 rows in set (0.00 sec)MySQL [test]> select * from t1 as of timestamp '2022-02-17 16:01:01';+------+------+| id | c1 |+------+------+| 1 | 1 || 2 | 2 || 3 | 3 || 4 | 4 |+------+------+4 rows in set (0.00 sec)
create table t3 select * from t1 as of timestamp '2022-02-17 16:01:01';
insert into t4 select * from t1 as of timestamp '2022-02-17 16:01:01';
パラメータ名 | パラメータ範囲 | タイプ | デフォルト値 | 数値範囲 | 再起動が必要か | 説明 |
Innodb_backquery_enable | グロバールパラメータ | Boolean | OFF | ON\\OFF | いいえ | フラッシュバッククエリー機能のオン・オフ。 |
Innodb_backquery_window | グロバールパラメータ | Integer | 900 | 1 - 86400 | いいえ | フラッシュバッククエリーをサポートする時間範囲(秒単位)。このパラメータの値が大きいほど、フラッシュバッククエリーでサポートされる履歴データの問合せ時間が長くなり、undo表領域が消費する記憶域が増加します。 |
Innodb_backquery_history_limit | グロバールパラメータ | Integer | 8000000 | 1 - 9223372036854476000 | いいえ | undoの履歴リンクテーブルの長さ制限。設定値を超えると、履歴リンクテーブルの長さが設定値を下回るまで、Innodb_backquery_windowのpurgeトリガが無視されます。 |
フィードバック