• 【MySQL】MariaDB10.3新特性--闪回查询


    MariaDB10.3新特性--闪回查询

    System-Versioned表特性的引入,可以对表进行闪回。完成类似于Oracle的闪回查询。

    修改已有表为System-Versioned

    MariaDB [zsd]> alter table test with system versioning;
    MariaDB [zsd]> select * from test;
    +------+-----------+
    | id   | name      |
    +------+-----------+
    |    1 | 张盛东    |
    |    2 | 刘忠浩    |
    +------+-----------+
    2 rows in set (0.001 sec)
    
    MariaDB [zsd]> select now();
    +---------------------+
    | now()               |
    +---------------------+
    | 2019-09-26 15:38:29 |
    +---------------------+
    1 row in set (0.000 sec)
    
    MariaDB [zsd]> insert into  test values(3,'胡轲');
    Query OK, 1 row affected (0.004 sec)
    

    对插入之前的时间点,做基于时间点的闪回查询,如下:

    MariaDB [zsd]> select * from test for SYSTEM_TIME AS OF TIMESTAMP '2019-09-26 15:38:29 ';
    +------+-----------+
    | id   | name      |
    +------+-----------+
    |    1 | 张盛东    |
    |    2 | 刘忠浩    |
    +------+-----------+
    2 rows in set (0.000 sec)
    
    MariaDB [zsd]> select * from test;
    +------+-----------+
    | id   | name      |
    +------+-----------+
    |    1 | 张盛东    |
    |    2 | 刘忠浩    |
    |    3 | 胡轲      |
    +------+-----------+
    3 rows in set (0.001 sec)
  • 相关阅读:
    OSCP Learning Notes
    OSCP Learning Notes
    OSCP Learning Notes
    OSCP Learning Notes
    OSCP Learning Notes
    OSCP Learning Notes
    OSCP Learning Notes
    OSCP Learning Notes
    Codeforces Round #601 (Div. 2) E2 Send Boxes to Alice (Hard Version)
    Codeforces Round #601 (Div. 2) E1 Send Boxes to Alice (Easy Version)
  • 原文地址:https://www.cnblogs.com/zhangshengdong/p/11724954.html
Copyright © 2020-2023  润新知