-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
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
query slower after migrated to tidb #7693
Comments
@gutongjiang Thanks for your feedback! Have you analyzed that table? |
@shenli What do you mean, should I provide more informations |
show create table ${involved_table_1}\G
show create table ${involved_table_2}\G
...
curl -G "http://${tidb-server-ip}:${tidb-server-status-port}/stats/dump/${db_name}/${table_name}" > ${table_name}_stats.json
|
Hi @gutongjiang , |
|
@jackysp the analyze doesn't work |
@gutongjiang pay attention to this:
I think the full range table scan is the root cause of slow execution speed. The filter for this query is: floginpassword = '3Eg+gKegvZ73HYz5c2c5JA==' and ftelephone = '13881964008' Can you add the following index for this table, and testing the speed of the query again once the index is added: alter table f_user add index idx_test(ftelephone, floginpassword);
-- or this index if the `password` is not suitable to be added in the index:
alter table f_user add index idx_test(ftelephone); |
@gutongjiang Does this table has an index on |
@shenli no |
Could you post the explain result of MySQL? How many rows are there in MySQL? |
@shenli Sorry, the mysql server has shutdown, but I know there are about 144000 rows |
@gutongjiang Have you set the time zone for your TiDB cluster? Or are you using the "System" timezone? |
@shenli the "System" timezone |
@gutongjiang There is performance downgrade when using the System time zone. We are solving this issue. Please refer to this PR. We hope to merge it today. In the current time, you can try to set the time zone explicitly (Use UTC or Asia/Shanghai). But I think TiDB could not be faster than MySQL in this size of data set. |
@gutongjiang Have you tried setting the system timezone? |
@gutongjiang we haven't heard back from you on this issue in more than 6 months, so I'm going to close this issue now. If you are still seeing this issue, please let us know! |
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
the same sql query slower than mysql :
select fid, floginname, fnickname, floginpassword, ftradepassword, ftelephone, femail, frealname, fidentityno, fidentitytype, fgoogleauthenticator, fgoogleurl, fstatus, fhasrealvalidate, fhasrealvalidatetime, fistelephonebind, fismailbind, fgooglebind, fupdatetime, fareacode, version, fintrouid, finvalidateintrocount, fiscny, fiscoin, fbirth, flastlogintime, fregistertime, ftradepwdtime, fshowid, flastip, fplatform, fcarruertype, fcarruernum, fleadercode, fleaderinvitedcode, fleaderstatus from f_user where floginpassword = '3Eg+gKegvZ73HYz5c2c5JA==' and ftelephone = '13881964008';
What did you expect to see?
What did you see instead?
mysql about 0.01sec
tidb about 11.00 sec
tidb-server -V
or runselect tidb_version();
on TiDB)?tidb-server -V
Release Version: v2.1.0-rc.1-7-g38c939f
Git Commit Hash: 38c939f4f95c802d85a5b6fd098a7a33daf0937f
Git Branch: master
UTC Build Time: 2018-08-27 01:53:09
GoVersion: go version go1.10.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
tikv-server --version
TiKV
Release Version: 2.1.0-rc.1
Git Commit Hash: 2174a98214e904dd9343817f001db1167614bd4c
Git Commit Branch: master
UTC Build Time: 2018-09-13 08:34:29
Rust Version: rustc 1.29.0-nightly (4f3c7a472 2018-07-17)
explain select fid, floginname, fnickname, floginpassword, ftradepassword, ftelephone, femail, frealname, fidentityno, fidentitytype, fgoogleauthenticator, fgoogleurl, fstatus, fhasrealvalidate, fhasrealvalidatetime, fistelephonebind, fismailbind, fgooglebind, fupdatetime, fareacode, version, fintrouid, finvalidateintrocount, fiscny, fiscoin, fbirth, flastlogintime, fregistertime, ftradepwdtime, fshowid, flastip, fplatform, fcarruertype, fcarruernum, fleadercode, fleaderinvitedcode, fleaderstatus from f_user where floginpassword = '3Eg+gKegvZ73HYz5c2c5JA==' and ftelephone = '13881964008'\G;
*************************** 1. row ***************************
id: Projection_4
count: 0.79
task: root
operator info: bae_test.f_user.fid, bae_test.f_user.floginname, bae_test.f_user.fnickname, bae_test.f_user.floginpassword, bae_test.f_user.ftradepassword, bae_test.f_user.ftelephone, bae_test.f_user.femail, bae_test.f_user.frealname, bae_test.f_user.fidentityno, bae_test.f_user.fidentitytype, bae_test.f_user.fgoogleauthenticator, bae_test.f_user.fgoogleurl, bae_test.f_user.fstatus, bae_test.f_user.fhasrealvalidate, bae_test.f_user.fhasrealvalidatetime, bae_test.f_user.fistelephonebind, bae_test.f_user.fismailbind, bae_test.f_user.fgooglebind, bae_test.f_user.fupdatetime, bae_test.f_user.fareacode, bae_test.f_user.version, bae_test.f_user.fintrouid, bae_test.f_user.finvalidateintrocount, bae_test.f_user.fiscny, bae_test.f_user.fiscoin, bae_test.f_user.fbirth, bae_test.f_user.flastlogintime, bae_test.f_user.fregistertime, bae_test.f_user.ftradepwdtime, bae_test.f_user.fshowid, bae_test.f_user.flastip, bae_test.f_user.fplatform, bae_test.f_user.fcarruertype, bae_test.f_user.fcarruernum, bae_test.f_user.fleadercode, bae_test.f_user.fleaderinvitedcode, bae_test.f_user.fleaderstatus
*************************** 2. row ***************************
id: └─TableReader_7
count: 0.79
task: root
operator info: data:Selection_6
*************************** 3. row ***************************
id: └─Selection_6
count: 0.79
task: cop
operator info: eq(bae_test.f_user.floginpassword, "3Eg+gKegvZ73HYz5c2c5JA=="), eq(bae_test.f_user.ftelephone, "13881964008")
*************************** 4. row ***************************
id: └─TableScan_5
count: 144927.00
task: cop
operator info: table:f_user, range:[-inf,+inf], keep order:false
The text was updated successfully, but these errors were encountered: