48 lines
2.2 KiB
Plaintext
48 lines
2.2 KiB
Plaintext
drop table if exists t1;
|
|
CREATE TABLE t1 (
|
|
ol_o_id int NOT NULL,
|
|
ol_d_id int NOT NULL,
|
|
ol_w_id int NOT NULL,
|
|
ol_number int NOT NULL,
|
|
ol_tmp int,
|
|
PRIMARY KEY (ol_w_id, ol_d_id, ol_o_id, ol_number)
|
|
) ENGINE=NDB
|
|
PARTITION BY HASH (ol_w_id);
|
|
insert into t1 values (1,0,0,0,0),(1,0,0,1,0),(1,0,0,2,0),(1,1,0,0,0),(1,1,0,1,0);
|
|
insert into t1 values (2,0,0,0,0),(4,0,0,0,0),(4,0,0,1,0);
|
|
insert into t1 values (0,1,1,4,0),(0,1,1,5,0);
|
|
UPDATE t1 force index (primary) SET ol_tmp = 1
|
|
WHERE ol_o_id = 0 AND ol_d_id = 1 AND ol_w_id = 1;
|
|
ndb_scan_count
|
|
1
|
|
Warnings:
|
|
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
|
|
ndb_pruned_scan_count
|
|
1
|
|
Warnings:
|
|
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
|
|
SELECT * FROM t1 WHERE ol_w_id = 1 AND ol_d_id = 1 AND ol_o_id = 0;
|
|
ol_o_id ol_d_id ol_w_id ol_number ol_tmp
|
|
0 1 1 4 1
|
|
0 1 1 5 1
|
|
ndb_scan_count
|
|
1
|
|
Warnings:
|
|
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
|
|
ndb_pruned_scan_count
|
|
1
|
|
Warnings:
|
|
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
|
|
SELECT SUM(ol_number) FROM t1 WHERE ol_o_id = 0 AND ol_w_id = 1 AND ol_d_id = 1;
|
|
SUM(ol_number)
|
|
9
|
|
ndb_scan_count
|
|
1
|
|
Warnings:
|
|
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
|
|
ndb_pruned_scan_count
|
|
1
|
|
Warnings:
|
|
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
|
|
drop table t1;
|