github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/snapshot/snapshot_read_2.result (about)

     1  create database if not exists snapshot_read;
     2  use snapshot_read;
     3  create table test_snapshot_read (a int);
     4  INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100);
     5  select count(*) from test_snapshot_read;
     6  count(*)
     7  100
     8  create snapshot snapshot_01 for account sys;
     9  delete from test_snapshot_read where a <= 50;
    10  create table t2(b int);
    11  INSERT INTO t2 (b) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100);
    12  select count(*) from t2;
    13  count(*)
    14  100
    15  create snapshot snapshot_02 for account sys;
    16  drop table if exists t3;
    17  create table t3(a int);
    18  insert into t3 SELECT * FROM test_snapshot_read{snapshot = 'snapshot_01'};
    19  select count(*) from t3;
    20  count(*)
    21  100
    22  select count(*) from test_snapshot_read {snapshot = 'snapshot_01'};
    23  count(*)
    24  100
    25  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read AS tsr INNER JOIN t2 ON tsr.a = t2.b;
    26  total_sum
    27  50
    28  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read{snapshot = 'snapshot_01'} AS tsr INNER JOIN t2 ON tsr.a = t2.b;
    29  total_sum
    30  100
    31  SELECT COUNT(tsr.a) AS total_sum FROM t3 AS tsr INNER JOIN t2 ON tsr.a = t2.b;
    32  total_sum
    33  100
    34  delete from t2 where b > 60;
    35  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read AS tsr INNER JOIN t2 ON tsr.a = t2.b;
    36  total_sum
    37  10
    38  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read {snapshot = 'snapshot_01'} AS tsr INNER JOIN t2 ON tsr.a = t2.b;
    39  total_sum
    40  60
    41  SELECT COUNT(tsr.a) AS total_sum FROM t3 AS tsr INNER JOIN t2 ON tsr.a = t2.b;
    42  total_sum
    43  60
    44  drop table if exists t4;
    45  create table t4(b int);
    46  insert into t4 SELECT * FROM t2 {snapshot = 'snapshot_02'};
    47  select count(*) from t4;
    48  count(*)
    49  100
    50  select count(*) from t2{snapshot = 'snapshot_02'};
    51  count(*)
    52  100
    53  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read {snapshot = 'snapshot_01'} AS tsr  INNER JOIN t2 {snapshot = 'snapshot_02'} ON tsr.a = t2.b ;
    54  total_sum
    55  100
    56  SELECT COUNT(tsr.a) AS total_sum FROM t3 AS tsr INNER JOIN t2 {snapshot = 'snapshot_02'} ON tsr.a = t2.b ;
    57  total_sum
    58  100
    59  SELECT COUNT(tsr.a) AS total_sum FROM t3 AS tsr INNER JOIN t4 ON tsr.a = t4.b;
    60  total_sum
    61  100
    62  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read {snapshot = 'snapshot_01'} AS tsr  INNER JOIN t4 ON tsr.a = t4.b;
    63  total_sum
    64  100
    65  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read {snapshot = 'snapshot_02'}  AS tsr INNER JOIN t2 {snapshot = 'snapshot_02'} ON tsr.a = t2.b;
    66  total_sum
    67  50
    68  SELECT COUNT(tsr.a) AS total_sum FROM test_snapshot_read AS tsr  INNER JOIN t2 {snapshot = 'snapshot_02'} ON tsr.a = t2.b;
    69  total_sum
    70  50
    71  drop table if exists t3;
    72  create table t3(c int);
    73  insert into t3 SELECT tsr.a AS total_sum FROM test_snapshot_read {snapshot = 'snapshot_01'}  AS tsr INNER JOIN t2 {snapshot = 'snapshot_02'} ON tsr.a = t2.b ;
    74  select count(*) from t3;
    75  count(*)
    76  100
    77  drop database snapshot_read;
    78  drop snapshot snapshot_01;
    79  drop snapshot snapshot_02;