We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CREATE TABLE IF NOT EXISTS node.travelrecord_qq ( id bigint NOT NULL AUTO_INCREMENT, user_id varchar(100) DEFAULT NULL, traveldate date DEFAULT NULL, fee decimal(10, 0) DEFAULT NULL, days int DEFAULT NULL, blob longblob, PRIMARY KEY (id), KEY id (id), KEY dex_user_id (user_id) ) ENGINE = InnoDB CHARSET = utf8 DBPARTITION BY mod_hash(user_id) DBPARTITIONS 10 TBPARTITION BY mod_hash(id) TBPARTITIONS 2;
node
travelrecord_qq
id
user_id
traveldate
fee
days
blob
dex_user_id
用user_id做为分库
SELECT COUNT(1) from travelrecord_qq WHERE user_id in(28) SELECT COUNT(1) from travelrecord_qq WHERE user_id in(18); 方式查询快
SELECT COUNT(1) from travelrecord_qq WHERE user_id in(18,28); in里多个值后查询很慢
查询对比如下:
in有多个值时,用explain查看,把所有库与所有库都用union all 连接了
The text was updated successfully, but these errors were encountered:
#703
565671f
http://dl.mycat.org.cn/2.0/1.22-release/mycat2-1.22-release-jar-with-dependencies-2022-5-19.jar
Sorry, something went wrong.
8f45f28
No branches or pull requests
CREATE TABLE IF NOT EXISTS
node
.travelrecord_qq
(id
bigint NOT NULL AUTO_INCREMENT,user_id
varchar(100) DEFAULT NULL,traveldate
date DEFAULT NULL,fee
decimal(10, 0) DEFAULT NULL,days
int DEFAULT NULL,blob
longblob,PRIMARY KEY (
id
),KEY
id
(id
),KEY
dex_user_id
(user_id
)) ENGINE = InnoDB CHARSET = utf8
DBPARTITION BY mod_hash(user_id) DBPARTITIONS 10
TBPARTITION BY mod_hash(id) TBPARTITIONS 2;
用user_id做为分库
SELECT COUNT(1) from travelrecord_qq WHERE user_id in(28)
SELECT COUNT(1) from travelrecord_qq WHERE user_id in(18);
方式查询快
SELECT COUNT(1) from travelrecord_qq WHERE user_id in(18,28);
in里多个值后查询很慢
查询对比如下:
in有多个值时,用explain查看,把所有库与所有库都用union all 连接了
The text was updated successfully, but these errors were encountered: