MariaDB [test]> create table t1 (a int) with system versioning partition by system_time (partition p0 history, partition pc current);
|
Query OK, 0 rows affected (0.077 sec)
|
|
MariaDB [test]> insert into t1 values (1);
|
Query OK, 1 row affected (0.016 sec)
|
|
MariaDB [test]> update t1 set a = 2;
|
Query OK, 1 row affected (0.011 sec)
|
Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
|
|
MariaDB [test]> create or replace table t2 like t1;
|
Query OK, 0 rows affected (0.107 sec)
|
|
MariaDB [test]> alter table t2 remove partitioning;
|
Query OK, 0 rows affected (0.190 sec)
|
Records: 0 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> alter table t1 exchange partition p0 with table t2;
|
Query OK, 0 rows affected (0.196 sec)
|
|
MariaDB [test]> select *, row_start, row_end from t1 for system_time all;
|
+------+----------------------------+----------------------------+
|
| a | row_start | row_end |
|
+------+----------------------------+----------------------------+
|
| 2 | 2019-04-09 11:30:18.041118 | 2038-01-19 05:14:07.999999 |
|
+------+----------------------------+----------------------------+
|
1 row in set (0.003 sec)
|
|
MariaDB [test]> select *, row_start, row_end from t2 for system_time all;
|
+------+----------------------------+----------------------------+
|
| a | row_start | row_end |
|
+------+----------------------------+----------------------------+
|
| 1 | 2019-04-09 11:30:12.247797 | 2019-04-09 11:30:18.041118 |
|
+------+----------------------------+----------------------------+
|
1 row in set (0.004 sec)
|
|
MariaDB [test]> update t1 set a = 3;
|
Query OK, 1 row affected (0.011 sec)
|
Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
|
|
MariaDB [test]> truncate table t2;
|
Query OK, 0 rows affected (0.075 sec)
|
|
MariaDB [test]> alter table t1 exchange partition pc with table t2;
|
Query OK, 0 rows affected (0.099 sec)
|
|
MariaDB [test]> select *, row_start, row_end from t1 for system_time all;
|
+------+----------------------------+----------------------------+
|
| a | row_start | row_end |
|
+------+----------------------------+----------------------------+
|
| 2 | 2019-04-09 11:30:18.041118 | 2019-04-09 11:34:30.988074 |
|
+------+----------------------------+----------------------------+
|
1 row in set (0.003 sec)
|
|
MariaDB [test]> select *, row_start, row_end from t2 for system_time all;
|
+------+----------------------------+----------------------------+
|
| a | row_start | row_end |
|
+------+----------------------------+----------------------------+
|
| 3 | 2019-04-09 11:34:30.988074 | 2038-01-19 05:14:07.999999 |
|
+------+----------------------------+----------------------------+
|
1 row in set (0.004 sec)
|