tpch: add query tuning configs for tpch#179
Conversation
|
I didn't realize that there exists such a flag. And yes, we should definitely do so. Thanks for pointing this out. I will update soon.
Is there an existing handy utility that I can use to differentiate tidb from other mysql-compatible databases? EDIT: And also I found there are already tidb-specific variables being used in, e.g.: Lines 175 to 180 in 50e155e Possibly meaning that current "mysql" can only be tidb? |
| } | ||
|
|
||
| func executeTpch(action string) { | ||
| if action == "run" && driver == "mysql" && tpchConfig.EnableQueryTuning { |
There was a problem hiding this comment.
This has to come prior to openDB() call because it leverages connection parameters which only take effect when connecting to the database.
I've updated the PR by leveraging existing connection parameters rather than explicitly setting session variables via SQL. About your second concern, the best I can do so far is to check for "mysql" only because there is no existing way to differentiate tidb from other possible mysql vendors, which is also affecting other tidb-specific logic. @Yui-Song Could you please take a look? Thanks. |
Set some session variables known to be effective for tpch before each tpch query to tune performance. And also add flags to turn it on/off and override the default variables.
tidb_default_string_match_selectivity=0.1: For optimal join order, esp. q9.tidb_opt_join_reorder_threshold=60: For general optimal join order.tidb_prefer_broadcast_join_by_exchange_data_size=ON: For better join type between broadcast join and partition join.