Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- the test is on INNER JOIN to better clarify the impact of independently sample the data
- CREATE volatile TABLE t1 (
- col INT
- )
- PRIMARY INDEX (col)
- ON commit preserve ROWS;
- CREATE volatile TABLE t2 (
- col INT
- )
- PRIMARY INDEX (col)
- ON commit preserve ROWS;
- INSERT INTO t1 (1);
- INSERT INTO t1 (2);
- INSERT INTO t1 (3);
- INSERT INTO t1 (4);
- INSERT INTO t1 (5);
- INSERT INTO t2 SELECT col FROM t1;
- -- it always return one row
- SELECT a.col FROM t1 a JOIN t2 b ON a.col=b.col sample 1;
- -- here I first tried to do the testcase with a single table
- -- it always return one row (it surprised me, but I'd assume it is an optimization to sample the same set from the same table)
- SELECT a.col FROM (SELECT * FROM t1 sample 1) a JOIN (SELECT * FROM t1 sample 1) b ON a.col=b.col;
- -- here we use two different tables, and the sample is working independently
- -- it doesn't return always a match
- SELECT a.col FROM (SELECT * FROM t1 sample 1) a JOIN (SELECT * FROM t2 sample 1) b ON a.col=b.col;
Advertisement
Add Comment
Please, Sign In to add comment