You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-10-31 18:30:33 +03:00
chore(QA): added MTR tests for TPC-H, removed printouts and added a doc on the feature.
This commit is contained in:
@@ -1153,11 +1153,7 @@ execplan::SCSEP CalpontSelectExecutionPlan::cloneForTableWORecursiveSelectsGbObH
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newReturnedCols.empty())
|
||||
{
|
||||
std::cout << "cloneForTableWORecursiveSelects(): there are no Returned Columns after table filtering."
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
newPlan->returnedCols(newReturnedCols);
|
||||
|
||||
// Deep copy of filters
|
||||
|
||||
@@ -5265,19 +5265,14 @@ void extractColumnStatistics(TABLE_LIST* table_ptr, gp_walk_info& gwi)
|
||||
{
|
||||
{
|
||||
Field* field = table_ptr->table->key_info[j].key_part[0].field;
|
||||
std::cout << "j index " << j << " i column " << 0 << " fieldnr "
|
||||
<< table_ptr->table->key_info[j].key_part[0].fieldnr << " " << field->field_name.str;
|
||||
if (field->read_stats)
|
||||
{
|
||||
auto* histogram = dynamic_cast<Histogram_json_hb*>(field->read_stats->histogram);
|
||||
if (histogram)
|
||||
{
|
||||
std::cout << " has stats with " << histogram->get_json_histogram().size() << " buckets";
|
||||
SchemaAndTableName tableName = {field->table->s->db.str, field->table->s->table_name.str};
|
||||
auto sc =
|
||||
std::unique_ptr<execplan::SimpleColumn>(buildSimpleColumnFromFieldForStatistics(field, gwi));
|
||||
std::cout << "sc with stats !!!!! " << sc->toString() << std::endl;
|
||||
|
||||
auto tableStatisticsMapIt = gwi.tableStatisticsMap.find(tableName);
|
||||
if (tableStatisticsMapIt == gwi.tableStatisticsMap.end())
|
||||
{
|
||||
@@ -5297,12 +5292,7 @@ void extractColumnStatistics(TABLE_LIST* table_ptr, gp_walk_info& gwi)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " no stats ";
|
||||
}
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7659,7 +7649,7 @@ int cs_get_select_plan(ha_columnstore_select_handler* handler, THD* thd, SCSEP&
|
||||
derivedTableOptimization(&gwi, csep);
|
||||
|
||||
{
|
||||
optimizer::RBOptimizerContext ctx(gwi, *thd, csep->traceOn(), get_ces_optimization_parallel_factor(thd));
|
||||
optimizer::RBOptimizerContext ctx(gwi, *thd, csep->traceOn(), get_query_accel_parallel_factor(thd));
|
||||
// TODO RBO can crash or fail leaving CSEP in an invalid state, so there must be a valid CSEP copy
|
||||
// TBD There is a tradeoff b/w copy per rule and copy per optimizer run.
|
||||
bool csepWasOptimized = optimizer::optimizeCSEP(*csep, ctx, get_unstable_optimizer(&ctx.getThd()));
|
||||
|
||||
@@ -266,11 +266,6 @@ struct gp_walk_info
|
||||
std::optional<ColumnStatisticsMap> findStatisticsForATable(SchemaAndTableName& schemaAndTableName)
|
||||
{
|
||||
auto tableStatisticsMapIt = tableStatisticsMap.find(schemaAndTableName);
|
||||
for (auto& [schemaAndTableName, columnStatisticsMap] : tableStatisticsMap)
|
||||
{
|
||||
std::cout << "Table " << schemaAndTableName.schema << "." << schemaAndTableName.table
|
||||
<< " has statistics " << columnStatisticsMap.size() << std::endl;
|
||||
}
|
||||
|
||||
if (tableStatisticsMapIt == tableStatisticsMap.end())
|
||||
{
|
||||
|
||||
@@ -87,9 +87,9 @@ static MYSQL_THDVAR_UINT(orderby_threads, PLUGIN_VAR_RQCMDARG,
|
||||
|
||||
static constexpr uint DEFAULT_CES_OPTIMIZATION_PARALLEL_FACTOR = 50;
|
||||
|
||||
static MYSQL_THDVAR_UINT(ces_optimization_parallel_factor, PLUGIN_VAR_RQCMDARG,
|
||||
"Maximum parallel factor for parallel CES optimization. (default to 50)", NULL, NULL, DEFAULT_CES_OPTIMIZATION_PARALLEL_FACTOR, 1,
|
||||
1000, 1);
|
||||
static MYSQL_THDVAR_UINT(query_accel_parallel_factor, PLUGIN_VAR_RQCMDARG,
|
||||
"Maximum parallel factor for parallel CES optimization. (default to 50)", NULL, NULL,
|
||||
DEFAULT_CES_OPTIMIZATION_PARALLEL_FACTOR, 1, 1000, 1);
|
||||
|
||||
// legacy system variables
|
||||
static MYSQL_THDVAR_ULONG(decimal_scale, PLUGIN_VAR_RQCMDARG,
|
||||
@@ -228,56 +228,55 @@ static MYSQL_THDVAR_ULONG(max_allowed_in_values, PLUGIN_VAR_RQCMDARG,
|
||||
|
||||
static my_bool innodb_queries_use_mcs;
|
||||
static MYSQL_SYSVAR_BOOL(innodb_queries_use_mcs, innodb_queries_use_mcs,
|
||||
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
||||
"Direct all InnoDB-only queries into MCS via Select Handler.", NULL, NULL, FALSE);
|
||||
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
||||
"Direct all InnoDB-only queries into MCS via Select Handler.", NULL, NULL, FALSE);
|
||||
static MYSQL_THDVAR_BOOL(unstable_optimizer, PLUGIN_VAR_RQCMDARG,
|
||||
"Apply optimizer rules after translation from SELECT_LEX/UNION", NULL, NULL, FALSE);
|
||||
"Apply optimizer rules after translation from SELECT_LEX/UNION", NULL, NULL, FALSE);
|
||||
|
||||
st_mysql_sys_var* mcs_system_variables[] = {
|
||||
MYSQL_SYSVAR(compression_type),
|
||||
MYSQL_SYSVAR(fe_conn_info_ptr),
|
||||
MYSQL_SYSVAR(original_optimizer_flags),
|
||||
MYSQL_SYSVAR(original_option_bits),
|
||||
MYSQL_SYSVAR(select_handler),
|
||||
MYSQL_SYSVAR(derived_handler),
|
||||
MYSQL_SYSVAR(select_handler_in_stored_procedures),
|
||||
MYSQL_SYSVAR(orderby_threads),
|
||||
MYSQL_SYSVAR(ces_optimization_parallel_factor),
|
||||
MYSQL_SYSVAR(decimal_scale),
|
||||
MYSQL_SYSVAR(use_decimal_scale),
|
||||
MYSQL_SYSVAR(ordered_only),
|
||||
MYSQL_SYSVAR(string_scan_threshold),
|
||||
MYSQL_SYSVAR(stringtable_threshold),
|
||||
MYSQL_SYSVAR(diskjoin_smallsidelimit),
|
||||
MYSQL_SYSVAR(diskjoin_largesidelimit),
|
||||
MYSQL_SYSVAR(diskjoin_bucketsize),
|
||||
MYSQL_SYSVAR(diskjoin_max_partition_tree_depth),
|
||||
MYSQL_SYSVAR(diskjoin_force_run),
|
||||
MYSQL_SYSVAR(max_pm_join_result_count),
|
||||
MYSQL_SYSVAR(um_mem_limit),
|
||||
MYSQL_SYSVAR(double_for_decimal_math),
|
||||
MYSQL_SYSVAR(decimal_overflow_check),
|
||||
MYSQL_SYSVAR(local_query),
|
||||
MYSQL_SYSVAR(use_import_for_batchinsert),
|
||||
MYSQL_SYSVAR(import_for_batchinsert_delimiter),
|
||||
MYSQL_SYSVAR(import_for_batchinsert_enclosed_by),
|
||||
MYSQL_SYSVAR(varbin_always_hex),
|
||||
MYSQL_SYSVAR(replication_slave),
|
||||
MYSQL_SYSVAR(cache_inserts),
|
||||
MYSQL_SYSVAR(cache_use_import),
|
||||
MYSQL_SYSVAR(cache_flush_threshold),
|
||||
MYSQL_SYSVAR(cmapi_host),
|
||||
MYSQL_SYSVAR(cmapi_port),
|
||||
MYSQL_SYSVAR(cmapi_version),
|
||||
MYSQL_SYSVAR(cmapi_key),
|
||||
MYSQL_SYSVAR(s3_key),
|
||||
MYSQL_SYSVAR(s3_secret),
|
||||
MYSQL_SYSVAR(s3_region),
|
||||
MYSQL_SYSVAR(pron),
|
||||
MYSQL_SYSVAR(max_allowed_in_values),
|
||||
MYSQL_SYSVAR(innodb_queries_use_mcs),
|
||||
MYSQL_SYSVAR(unstable_optimizer),
|
||||
NULL};
|
||||
st_mysql_sys_var* mcs_system_variables[] = {MYSQL_SYSVAR(compression_type),
|
||||
MYSQL_SYSVAR(fe_conn_info_ptr),
|
||||
MYSQL_SYSVAR(original_optimizer_flags),
|
||||
MYSQL_SYSVAR(original_option_bits),
|
||||
MYSQL_SYSVAR(select_handler),
|
||||
MYSQL_SYSVAR(derived_handler),
|
||||
MYSQL_SYSVAR(select_handler_in_stored_procedures),
|
||||
MYSQL_SYSVAR(orderby_threads),
|
||||
MYSQL_SYSVAR(query_accel_parallel_factor),
|
||||
MYSQL_SYSVAR(decimal_scale),
|
||||
MYSQL_SYSVAR(use_decimal_scale),
|
||||
MYSQL_SYSVAR(ordered_only),
|
||||
MYSQL_SYSVAR(string_scan_threshold),
|
||||
MYSQL_SYSVAR(stringtable_threshold),
|
||||
MYSQL_SYSVAR(diskjoin_smallsidelimit),
|
||||
MYSQL_SYSVAR(diskjoin_largesidelimit),
|
||||
MYSQL_SYSVAR(diskjoin_bucketsize),
|
||||
MYSQL_SYSVAR(diskjoin_max_partition_tree_depth),
|
||||
MYSQL_SYSVAR(diskjoin_force_run),
|
||||
MYSQL_SYSVAR(max_pm_join_result_count),
|
||||
MYSQL_SYSVAR(um_mem_limit),
|
||||
MYSQL_SYSVAR(double_for_decimal_math),
|
||||
MYSQL_SYSVAR(decimal_overflow_check),
|
||||
MYSQL_SYSVAR(local_query),
|
||||
MYSQL_SYSVAR(use_import_for_batchinsert),
|
||||
MYSQL_SYSVAR(import_for_batchinsert_delimiter),
|
||||
MYSQL_SYSVAR(import_for_batchinsert_enclosed_by),
|
||||
MYSQL_SYSVAR(varbin_always_hex),
|
||||
MYSQL_SYSVAR(replication_slave),
|
||||
MYSQL_SYSVAR(cache_inserts),
|
||||
MYSQL_SYSVAR(cache_use_import),
|
||||
MYSQL_SYSVAR(cache_flush_threshold),
|
||||
MYSQL_SYSVAR(cmapi_host),
|
||||
MYSQL_SYSVAR(cmapi_port),
|
||||
MYSQL_SYSVAR(cmapi_version),
|
||||
MYSQL_SYSVAR(cmapi_key),
|
||||
MYSQL_SYSVAR(s3_key),
|
||||
MYSQL_SYSVAR(s3_secret),
|
||||
MYSQL_SYSVAR(s3_region),
|
||||
MYSQL_SYSVAR(pron),
|
||||
MYSQL_SYSVAR(max_allowed_in_values),
|
||||
MYSQL_SYSVAR(innodb_queries_use_mcs),
|
||||
MYSQL_SYSVAR(unstable_optimizer),
|
||||
NULL};
|
||||
|
||||
st_mysql_show_var mcs_status_variables[] = {{"columnstore_version", (char*)&cs_version, SHOW_CHAR},
|
||||
{"columnstore_commit_hash", (char*)&cs_commit_hash, SHOW_CHAR},
|
||||
@@ -375,13 +374,13 @@ void set_orderby_threads(THD* thd, uint value)
|
||||
THDVAR(thd, orderby_threads) = value;
|
||||
}
|
||||
|
||||
uint get_ces_optimization_parallel_factor(THD* thd)
|
||||
uint get_query_accel_parallel_factor(THD* thd)
|
||||
{
|
||||
return (thd == NULL) ? DEFAULT_CES_OPTIMIZATION_PARALLEL_FACTOR : THDVAR(thd, ces_optimization_parallel_factor);
|
||||
return (thd == NULL) ? DEFAULT_CES_OPTIMIZATION_PARALLEL_FACTOR : THDVAR(thd, query_accel_parallel_factor);
|
||||
}
|
||||
void set_ces_optimization_parallel_factor(THD* thd, uint value)
|
||||
void set_query_accel_parallel_factor(THD* thd, uint value)
|
||||
{
|
||||
THDVAR(thd, ces_optimization_parallel_factor) = value;
|
||||
THDVAR(thd, query_accel_parallel_factor) = value;
|
||||
}
|
||||
|
||||
bool get_use_decimal_scale(THD* thd)
|
||||
|
||||
@@ -81,8 +81,8 @@ void set_select_handler_in_stored_procedures(THD* thd, bool value);
|
||||
uint get_orderby_threads(THD* thd);
|
||||
void set_orderby_threads(THD* thd, uint value);
|
||||
|
||||
uint get_ces_optimization_parallel_factor(THD* thd);
|
||||
void set_ces_optimization_parallel_factor(THD* thd, uint value);
|
||||
uint get_query_accel_parallel_factor(THD* thd);
|
||||
void set_query_accel_parallel_factor(THD* thd, uint value);
|
||||
|
||||
bool get_use_decimal_scale(THD* thd);
|
||||
void set_use_decimal_scale(THD* thd, bool value);
|
||||
|
||||
@@ -283,15 +283,9 @@ std::optional<details::FilterRangeBounds<T>> populateRangeBounds(Histogram_json_
|
||||
|
||||
// Get parallel factor from context
|
||||
size_t maxParallelFactor = ctx.getCesOptimizationParallelFactor();
|
||||
std::cout << "populateRangeBounds() columnStatistics->buckets.size() "
|
||||
<< columnStatistics->get_json_histogram().size() << std::endl;
|
||||
std::cout << "Session ces_optimization_parallel_factor: " << maxParallelFactor << std::endl;
|
||||
size_t numberOfUnionUnits = std::min(columnStatistics->get_json_histogram().size(), maxParallelFactor);
|
||||
size_t numberOfBucketsPerUnionUnit = columnStatistics->get_json_histogram().size() / numberOfUnionUnits;
|
||||
|
||||
std::cout << "Number of union units: " << numberOfUnionUnits << std::endl;
|
||||
std::cout << "Number of buckets per union unit: " << numberOfBucketsPerUnionUnit << std::endl;
|
||||
|
||||
// Loop over buckets to produce filter ranges
|
||||
// NB Currently Histogram_json_hb has the last bucket that has end as its start
|
||||
for (size_t i = 0; i < numberOfUnionUnits - 1; ++i)
|
||||
@@ -324,22 +318,7 @@ std::optional<details::FilterRangeBounds<T>> populateRangeBounds(Histogram_json_
|
||||
// Ensure the first bound starts from the minimal representable value to avoid dropping values
|
||||
if (!bounds.empty())
|
||||
{
|
||||
T originalFirstLower = bounds.front().first;
|
||||
bounds.front().first = std::numeric_limits<T>::lowest();
|
||||
std::cout << "Adjusted first bound lower from " << originalFirstLower << " to " << bounds.front().first
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
for (auto& bucket : columnStatistics->get_json_histogram())
|
||||
{
|
||||
T currentLowerBound = static_cast<T>(decodeU64(bucket.start_value));
|
||||
std::cout << "Bucket: " << currentLowerBound << std::endl;
|
||||
}
|
||||
// Note: last bound now uses histogram's last end endpoint to cover the tail.
|
||||
|
||||
for (auto& bound : bounds)
|
||||
{
|
||||
std::cout << "Bound: " << bound.first << " " << bound.second << std::endl;
|
||||
}
|
||||
|
||||
return bounds;
|
||||
|
||||
1156
docs/QA_parallel.md
1156
docs/QA_parallel.md
File diff suppressed because it is too large
Load Diff
36
docs/QueryAccelerator.md
Normal file
36
docs/QueryAccelerator.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# What is Query Accelarator
|
||||
|
||||
Query Accelarator is a feature that allows MariaDB to use ColumnStore to execute queries that are otherwise executed by InnoDB.
|
||||
Under the hood Columnstore:
|
||||
- receives a query
|
||||
- searches for applicable Engine Independent statistics for InnoDB table index column
|
||||
- applies RBO rule to transform its InnoDB tables into a number of UNIONs over non-overlapping ranges of a suitable InnoDB table index
|
||||
- retrives the data in parallel from MariaDB and runs it using Columnstore runtime
|
||||
|
||||
# How to enable Query Accelerator
|
||||
|
||||
- One has to set `columnstore_innodb_queries_use_mcs = on` in MariaDB configuration file and restart MariaDB server(my.cnf).
|
||||
- Set a number of parameters in a client session:
|
||||
```SQL
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
```
|
||||
|
||||
# Enable ColumnStore processing for InnoDB tables
|
||||
There must be Engine Independent statistics for InnoDB table index column to be used for Query Accelerator.
|
||||
```SQL
|
||||
analyze table <table_name> persistent for columns (<column_name>) indexes();
|
||||
```
|
||||
|
||||
# Control client session variables and parameters
|
||||
|
||||
- `columnstore_unstable_optimizer`: enables unstable optimizer that is required for Query Accelerator RBO rule
|
||||
- `columnstore_select_handler`: enables/disables ColumnStore processing for InnoDB tables
|
||||
- `columnstore_query_accel_parallel_factor` : controls the number of parallel ranges to be used for Query Accelerator
|
||||
|
||||
Watch out `max_connections`. If you set `columnstore_query_accel_parallel_factor` to a high value, you may need to increase `max_connections` to avoid connection pool exhaustion.
|
||||
|
||||
# How to verify QA is being used
|
||||
There are two ways to verify QA is being used:
|
||||
1. Use `select mcs_get_plan('rules')` to get a list of the rules that were applied to the query.
|
||||
2. Look for patterns like `derived table - $added_sub_#db_name_#table_name_X` in the optimized plan using `select mcs_get_plan('optimized')`.
|
||||
@@ -1,25 +0,0 @@
|
||||
# For manual usage only!
|
||||
|
||||
select l_orderkey,l_suppkey from lineitem limit 10;
|
||||
select l_suppkey,l_orderkey from (select l_suppkey,l_orderkey from lineitem limit 10) s1;
|
||||
|
||||
select s1.* from (select l_suppkey+1 as ho,l_orderkey+1 as mo from lineitem limit 10) s1;
|
||||
select mo,ho from (select l_suppkey+1 as ho,l_orderkey+1 as mo from lineitem limit 10) s1;
|
||||
|
||||
select nl.l_suppkey,lineitem.l_suppkey from lineitem,lineitem_10rows nl WHERE lineitem.l_suppkey=nl.l_suppkey limit 10;
|
||||
|
||||
select nl.l_orderkey,l.l_suppkey,nl.l_suppkey,l.l_suppkey from lineitem l,lineitem_10rows nl WHERE l.l_suppkey=nl.l_suppkey limit 10;
|
||||
# test set with join
|
||||
select nl.l_orderkey,l.l_suppkey,nl.l_suppkey,l.l_orderkey from lineitem l,lineitem_10rows nl WHERE l.l_suppkey=nl.l_suppkey limit 10;
|
||||
|
||||
select nl.l_orderkey,l.l_suppkey,nl.l_suppkey,l.l_orderkey from (select l_orderkey,l_suppkey from lineitem) l,lineitem_10rows nl WHERE l.l_suppkey=nl.l_suppkey limit 10;
|
||||
select * from (select l_orderkey,l_suppkey+1 from lineitem limit 10) sa where sa.l_orderkey = 1999905;
|
||||
|
||||
|
||||
elect nl.l_orderkey,l.l_suppkey,nl.l_suppkey,l.l_orderkey from (select l_orderkey,l_suppkey from lineitem) l,(select l_orderkey,l_suppkey from lineitem_10rows) nl WHERE l.l_suppkey=nl.l_suppkey limit 10;
|
||||
|
||||
|
||||
select nl.l_orderkey,l.l_suppkey+1 from lineitem l,lineitem_10rows nl WHERE l.l_suppkey=nl.l_suppkey limit 10
|
||||
|
||||
select nl.l_suppkey,lineitem.l_suppkey from lineitem,lineitem_10rows nl WHERE lineitem.l_suppkey=nl.l_suppkey AND lineitem.l_suppkey = 25 limit 10;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
CREATE USER IF NOT EXISTS'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001';
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces;
|
||||
CREATE DATABASE rbo_parallel_ces;
|
||||
USE rbo_parallel_ces;
|
||||
@@ -16,9 +13,9 @@ Table Op Msg_type Msg_text
|
||||
rbo_parallel_ces.Ti analyze status Engine-independent statistics collected
|
||||
rbo_parallel_ces.Ti analyze status OK
|
||||
CREATE INDEX excellent_index ON Ti(col1);
|
||||
SET @@columnstore_unstable_optimizer=ON;
|
||||
SET @@optimizer_switch='derived_merge=off';
|
||||
SET @@columnstore_ces_optimization_parallel_factor=5;
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
SET @@columnstore_query_accel_parallel_factor=5;
|
||||
SELECT SUM(col1) FROM Ti;
|
||||
SUM(col1)
|
||||
5050
|
||||
@@ -37,7 +34,7 @@ unions_optimized_5
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
rule_parallel_ces_applied
|
||||
1
|
||||
SET @@columnstore_ces_optimization_parallel_factor=15;
|
||||
SET @@columnstore_query_accel_parallel_factor=15;
|
||||
SELECT SUM(col1) FROM Ti;
|
||||
SUM(col1)
|
||||
5050
|
||||
@@ -50,5 +47,5 @@ SELECT calsettrace(0);
|
||||
calsettrace(0)
|
||||
1
|
||||
DROP DATABASE rbo_parallel_ces;
|
||||
REVOKE ALL PRIVILEGES ON *.* FROM 'cejuser'@'localhost';
|
||||
DROP USER 'cejuser'@'localhost';
|
||||
set columnstore_unstable_optimizer=off;
|
||||
set optimizer_switch=default;
|
||||
|
||||
@@ -28,11 +28,10 @@ ANALYZE TABLE Ti PERSISTENT FOR ALL;
|
||||
CREATE INDEX excellent_index ON Ti(col1);
|
||||
|
||||
# Enable RBO
|
||||
SET @@columnstore_unstable_optimizer=ON;
|
||||
SET @@optimizer_switch='derived_merge=off';
|
||||
--source ../include/enable_rbo_parallel_ces.inc
|
||||
|
||||
# First run with parallel factor 5
|
||||
SET @@columnstore_ces_optimization_parallel_factor=5;
|
||||
SET @@columnstore_query_accel_parallel_factor=5;
|
||||
|
||||
# Execute a query to build and store plans
|
||||
SELECT SUM(col1) FROM Ti;
|
||||
@@ -55,7 +54,7 @@ SELECT (CHAR_LENGTH(@uu_tail) - CHAR_LENGTH(REPLACE(@uu_tail, @unit_open, '')))/
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
|
||||
# Increase factor to 15 but expect 10 unions due to histogram_size cap
|
||||
SET @@columnstore_ces_optimization_parallel_factor=15;
|
||||
SET @@columnstore_query_accel_parallel_factor=15;
|
||||
|
||||
# Re-execute to rebuild plan with new factor
|
||||
SELECT SUM(col1) FROM Ti;
|
||||
@@ -68,5 +67,6 @@ SELECT (CHAR_LENGTH(@uu_tail) - CHAR_LENGTH(REPLACE(@uu_tail, @unit_open, '')))/
|
||||
SELECT calsettrace(0);
|
||||
DROP DATABASE rbo_parallel_ces;
|
||||
|
||||
--source ../include/disable_rbo_parallel_ces.inc
|
||||
--source ../include/drop_functions.inc
|
||||
--source ../include/drop_cross_engine.inc
|
||||
|
||||
107
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q1.result
Normal file
107
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q1.result
Normal file
@@ -0,0 +1,107 @@
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces_tpch;
|
||||
CREATE DATABASE rbo_parallel_ces_tpch;
|
||||
USE rbo_parallel_ces_tpch;
|
||||
SELECT calsettrace(1);
|
||||
calsettrace(1)
|
||||
0
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
CREATE TABLE `lineitem` (
|
||||
`L_ORDERKEY` int(11) NOT NULL,
|
||||
`L_PARTKEY` int(11) NOT NULL,
|
||||
`L_SUPPKEY` int(11) NOT NULL,
|
||||
`L_LINENUMBER` int(11) NOT NULL,
|
||||
`L_QUANTITY` decimal(15,2) NOT NULL,
|
||||
`L_EXTENDEDPRICE` decimal(15,2) NOT NULL,
|
||||
`L_DISCOUNT` decimal(15,2) NOT NULL,
|
||||
`L_TAX` decimal(15,2) NOT NULL,
|
||||
`L_RETURNFLAG` char(1) NOT NULL,
|
||||
`L_LINESTATUS` char(1) NOT NULL,
|
||||
`L_SHIPDATE` date NOT NULL,
|
||||
`L_COMMITDATE` date NOT NULL,
|
||||
`L_RECEIPTDATE` date NOT NULL,
|
||||
`L_SHIPINSTRUCT` char(25) NOT NULL,
|
||||
`L_SHIPMODE` char(10) NOT NULL,
|
||||
`L_COMMENT` varchar(44) NOT NULL,
|
||||
`recdate_gt_commitdate` tinyint(4) NOT NULL DEFAULT 0,
|
||||
KEY `L_ORDERKEY` (`L_ORDERKEY`,`L_SUPPKEY`,`recdate_gt_commitdate`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
INSERT INTO `lineitem` (
|
||||
`L_ORDERKEY`, `L_PARTKEY`, `L_SUPPKEY`, `L_LINENUMBER`,
|
||||
`L_QUANTITY`, `L_EXTENDEDPRICE`, `L_DISCOUNT`, `L_TAX`,
|
||||
`L_RETURNFLAG`, `L_LINESTATUS`, `L_SHIPDATE`, `L_COMMITDATE`, `L_RECEIPTDATE`,
|
||||
`L_SHIPINSTRUCT`, `L_SHIPMODE`, `L_COMMENT`, `recdate_gt_commitdate`
|
||||
) VALUES
|
||||
(32, 197921, 441, 2, 32.00, 64605.44, 0.02, 0.00, 'N', 'O', '1995-08-14', '1995-10-07', '1995-08-27', 'COLLECT COD', 'AIR', 'lithely regular deposits. fluffily', 0),
|
||||
(3, 128449, 3474, 3, 27.00, 39890.88, 0.06, 0.07, 'A', 'F', '1994-01-16', '1993-11-22', '1994-01-23', 'DELIVER IN PERSON', 'SHIP', 'nal foxes wake. ', 1),
|
||||
(4, 88035, 5560, 1, 30.00, 30690.90, 0.03, 0.08, 'N', 'O', '1996-01-10', '1995-12-14', '1996-01-18', 'DELIVER IN PERSON', 'REG AIR', '- quickly regular packages sleep. idly', 1),
|
||||
(5, 123927, 3928, 2, 26.00, 50723.92, 0.07, 0.08, 'R', 'F', '1994-10-16', '1994-09-25', '1994-10-19', 'NONE', 'FOB', 'sts use slyly quickly special instruc', 1),
|
||||
(7, 182052, 9607, 1, 12.00, 13608.60, 0.07, 0.03, 'N', 'O', '1996-05-07', '1996-03-13', '1996-06-03', 'TAKE BACK RETURN', 'FOB', 'ss pinto beans wake against th', 1),
|
||||
(34, 88362, 871, 1, 13.00, 17554.68, 0.00, 0.07, 'N', 'O', '1998-10-23', '1998-09-14', '1998-11-06', 'NONE', 'REG AIR', 'nic accounts. deposits are alon', 1),
|
||||
(1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, 'N', 'O', '1996-03-13', '1996-02-12', '1996-03-22', 'DELIVER IN PERSON', 'TRUCK', 'egular courts above the', 1),
|
||||
(33, 137469, 9983, 3, 5.00, 7532.30, 0.05, 0.03, 'A', 'F', '1993-12-09', '1993-12-25', '1993-12-23', 'TAKE BACK RETURN', 'AIR', '. stealthily bold exc', 0),
|
||||
(151872, 939, 940, 2, 42.00, 77277.06, 0.01, 0.00, 'N', 'O', '1995-09-30', '1995-09-28', '1995-10-27', 'TAKE BACK RETURN', 'TRUCK', 'ly slyly fina', 1),
|
||||
(77632, 966, 967, 4, 11.00, 20536.56, 0.04, 0.03, 'N', 'O', '1995-09-28', '1995-09-22', '1995-10-24', 'NONE', 'FOB', 'nts was furi', 1),
|
||||
(26439, 1085, 1086, 3, 3.00, 2958.24, 0.03, 0.00, 'N', 'O', '1995-09-30', '1995-12-04', '1995-10-22', 'DELIVER IN PERSON', 'TRUCK', 'ackages wake slyly a', 0),
|
||||
(98599, 1239, 8740, 2, 48.00, 54731.04, 0.09, 0.06, 'N', 'O', '1995-09-24', '1995-08-26', '1995-10-02', 'TAKE BACK RETURN', 'TRUCK', 'ake always p', 1),
|
||||
(95301, 1343, 8844, 2, 33.00, 41063.22, 0.00, 0.01, 'N', 'O', '1995-09-09', '1995-11-01', '1995-09-28', 'TAKE BACK RETURN', 'FOB', 'carefully regular requests. requests', 0),
|
||||
(83008, 2988, 2989, 2, 12.00, 22691.76, 0.06, 0.07, 'N', 'O', '1995-09-15', '1995-09-24', '1995-10-09', 'NONE', 'RAIL', 'into beans do', 1),
|
||||
(117665, 3024, 3025, 4, 10.00, 9270.20, 0.02, 0.01, 'N', 'O', '1995-09-17', '1995-08-26', '1995-10-12', 'COLLECT COD', 'AIR', 'about the slyly even req', 1),
|
||||
(163746, 3126, 8127, 4, 45.00, 46310.40, 0.02, 0.00, 'N', 'O', '1995-09-21', '1995-09-17', '1995-10-01', 'DELIVER IN PERSON', 'RAIL', 'ggle. regular de', 1),
|
||||
(161669, 3142, 8143, 3, 42.00, 43895.88, 0.06, 0.06, 'N', 'O', '1995-09-29', '1995-09-09', '1995-10-29', 'COLLECT COD', 'RAIL', 'ts. unusual accounts gro', 1),
|
||||
(81826, 3357, 8358, 5, 5.00, 6301.75, 0.05, 0.04, 'N', 'O', '1995-09-06', '1995-06-14', '1995-09-19', 'TAKE BACK RETURN', 'FOB', 'y final pains x-ray blithely. pen', 1),
|
||||
(118849, 3625, 6126, 5, 24.00, 36686.88, 0.09, 0.01, 'N', 'O', '1995-09-24', '1995-09-23', '1995-09-27', 'COLLECT COD', 'RAIL', 'c requests. furiously stealthy theodoli', 1),
|
||||
(135239, 4119, 1620, 5, 36.00, 36831.96, 0.05, 0.03, 'N', 'O', '1995-09-06', '1995-07-16', '1995-09-09', 'COLLECT COD', 'AIR', ' after the accounts. qu', 1),
|
||||
(30944, 4466, 9467, 1, 47.00, 64411.62, 0.02, 0.02, 'N', 'O', '1995-09-27', '1995-08-03', '1995-10-11', 'COLLECT COD', 'FOB', 'k platelets nag. slyly regular instructio', 1);
|
||||
set histogram_size=2;
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS(l_orderkey) INDEXES();
|
||||
Table Op Msg_type Msg_text
|
||||
rbo_parallel_ces_tpch.lineitem analyze status Engine-independent statistics collected
|
||||
rbo_parallel_ces_tpch.lineitem analyze status OK
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
select
|
||||
l_returnflag,
|
||||
l_linestatus,
|
||||
sum(l_quantity) as sum_qty,
|
||||
sum(l_extendedprice) as sum_base_price,
|
||||
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
|
||||
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
|
||||
avg(l_quantity) as avg_qty,
|
||||
avg(l_extendedprice) as avg_price,
|
||||
avg(l_discount) as avg_disc,
|
||||
count(*) as count_order
|
||||
from
|
||||
lineitem
|
||||
where
|
||||
l_shipdate <= date '1998-12-01' - interval '90' day
|
||||
group by
|
||||
l_returnflag,
|
||||
l_linestatus
|
||||
order by
|
||||
l_returnflag,
|
||||
l_linestatus;
|
||||
l_returnflag l_linestatus sum_qty sum_base_price sum_disc_price sum_charge avg_qty avg_price avg_disc count_order
|
||||
A F 32.00 47423.18 44653.1122 47492.602654 16.000000 23711.590000 0.055000 2
|
||||
N O 449.00 593039.74 570565.1917 584668.504528 26.411765 34884.690588 0.041176 17
|
||||
R F 26.00 50723.92 47173.2456 50947.105248 26.000000 50723.920000 0.070000 1
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
SET @rbo_rules := mcs_get_plan('rules');
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
rule_parallel_ces_applied
|
||||
1
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
set @rewritten_derived_name = 'derived table - $added_sub_rbo_parallel_ces_tpch_lineitem_0';
|
||||
set @original_table_name = '.lineitem(lineitem/) engineType=ForeignEngine';
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) AS rewritten_derived_table_count;
|
||||
rewritten_derived_table_count
|
||||
1.0000
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @original_table_name, ''))) / CHAR_LENGTH(@original_table_name) AS original_table_count;
|
||||
original_table_count
|
||||
3.0000
|
||||
SELECT calsettrace(0);
|
||||
calsettrace(0)
|
||||
1
|
||||
DROP DATABASE rbo_parallel_ces_tpch;
|
||||
set columnstore_unstable_optimizer=off;
|
||||
set optimizer_switch=default;
|
||||
67
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q1.test
Normal file
67
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q1.test
Normal file
@@ -0,0 +1,67 @@
|
||||
--source ../include/have_columnstore.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../include/functions.inc
|
||||
--source ../include/cross_engine.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces_tpch;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE rbo_parallel_ces_tpch;
|
||||
USE rbo_parallel_ces_tpch;
|
||||
|
||||
# Turn on plan logging to capture CSEP strings
|
||||
SELECT calsettrace(1);
|
||||
|
||||
# Enable RBO
|
||||
--source ../include/enable_rbo_parallel_ces.inc
|
||||
|
||||
--source ../include/create_tpch_lineitem.inc
|
||||
|
||||
set histogram_size=2;
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS(l_orderkey) INDEXES();
|
||||
|
||||
--source ../include/enable_rbo_parallel_ces.inc
|
||||
|
||||
select
|
||||
l_returnflag,
|
||||
l_linestatus,
|
||||
sum(l_quantity) as sum_qty,
|
||||
sum(l_extendedprice) as sum_base_price,
|
||||
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
|
||||
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
|
||||
avg(l_quantity) as avg_qty,
|
||||
avg(l_extendedprice) as avg_price,
|
||||
avg(l_discount) as avg_disc,
|
||||
count(*) as count_order
|
||||
from
|
||||
lineitem
|
||||
where
|
||||
l_shipdate <= date '1998-12-01' - interval '90' day
|
||||
group by
|
||||
l_returnflag,
|
||||
l_linestatus
|
||||
order by
|
||||
l_returnflag,
|
||||
l_linestatus;
|
||||
|
||||
# Snapshot plans into variables for readability
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
SET @rbo_rules := mcs_get_plan('rules');
|
||||
|
||||
# Ensure rule was applied
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
set @rewritten_derived_name = 'derived table - $added_sub_rbo_parallel_ces_tpch_lineitem_0';
|
||||
set @original_table_name = '.lineitem(lineitem/) engineType=ForeignEngine';
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) AS rewritten_derived_table_count;
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @original_table_name, ''))) / CHAR_LENGTH(@original_table_name) AS original_table_count;
|
||||
|
||||
# Cleanup
|
||||
SELECT calsettrace(0);
|
||||
DROP DATABASE rbo_parallel_ces_tpch;
|
||||
|
||||
--source ../include/disable_rbo_parallel_ces.inc
|
||||
--source ../include/drop_functions.inc
|
||||
--source ../include/drop_cross_engine.inc
|
||||
136
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q14.result
Normal file
136
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q14.result
Normal file
@@ -0,0 +1,136 @@
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces_tpch;
|
||||
CREATE DATABASE rbo_parallel_ces_tpch;
|
||||
USE rbo_parallel_ces_tpch;
|
||||
SELECT calsettrace(1);
|
||||
calsettrace(1)
|
||||
0
|
||||
CREATE TABLE `lineitem` (
|
||||
`L_ORDERKEY` int(11) NOT NULL,
|
||||
`L_PARTKEY` int(11) NOT NULL,
|
||||
`L_SUPPKEY` int(11) NOT NULL,
|
||||
`L_LINENUMBER` int(11) NOT NULL,
|
||||
`L_QUANTITY` decimal(15,2) NOT NULL,
|
||||
`L_EXTENDEDPRICE` decimal(15,2) NOT NULL,
|
||||
`L_DISCOUNT` decimal(15,2) NOT NULL,
|
||||
`L_TAX` decimal(15,2) NOT NULL,
|
||||
`L_RETURNFLAG` char(1) NOT NULL,
|
||||
`L_LINESTATUS` char(1) NOT NULL,
|
||||
`L_SHIPDATE` date NOT NULL,
|
||||
`L_COMMITDATE` date NOT NULL,
|
||||
`L_RECEIPTDATE` date NOT NULL,
|
||||
`L_SHIPINSTRUCT` char(25) NOT NULL,
|
||||
`L_SHIPMODE` char(10) NOT NULL,
|
||||
`L_COMMENT` varchar(44) NOT NULL,
|
||||
`recdate_gt_commitdate` tinyint(4) NOT NULL DEFAULT 0,
|
||||
KEY `L_ORDERKEY` (`L_ORDERKEY`,`L_SUPPKEY`,`recdate_gt_commitdate`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
INSERT INTO `lineitem` (
|
||||
`L_ORDERKEY`, `L_PARTKEY`, `L_SUPPKEY`, `L_LINENUMBER`,
|
||||
`L_QUANTITY`, `L_EXTENDEDPRICE`, `L_DISCOUNT`, `L_TAX`,
|
||||
`L_RETURNFLAG`, `L_LINESTATUS`, `L_SHIPDATE`, `L_COMMITDATE`, `L_RECEIPTDATE`,
|
||||
`L_SHIPINSTRUCT`, `L_SHIPMODE`, `L_COMMENT`, `recdate_gt_commitdate`
|
||||
) VALUES
|
||||
(32, 197921, 441, 2, 32.00, 64605.44, 0.02, 0.00, 'N', 'O', '1995-08-14', '1995-10-07', '1995-08-27', 'COLLECT COD', 'AIR', 'lithely regular deposits. fluffily', 0),
|
||||
(3, 128449, 3474, 3, 27.00, 39890.88, 0.06, 0.07, 'A', 'F', '1994-01-16', '1993-11-22', '1994-01-23', 'DELIVER IN PERSON', 'SHIP', 'nal foxes wake. ', 1),
|
||||
(4, 88035, 5560, 1, 30.00, 30690.90, 0.03, 0.08, 'N', 'O', '1996-01-10', '1995-12-14', '1996-01-18', 'DELIVER IN PERSON', 'REG AIR', '- quickly regular packages sleep. idly', 1),
|
||||
(5, 123927, 3928, 2, 26.00, 50723.92, 0.07, 0.08, 'R', 'F', '1994-10-16', '1994-09-25', '1994-10-19', 'NONE', 'FOB', 'sts use slyly quickly special instruc', 1),
|
||||
(7, 182052, 9607, 1, 12.00, 13608.60, 0.07, 0.03, 'N', 'O', '1996-05-07', '1996-03-13', '1996-06-03', 'TAKE BACK RETURN', 'FOB', 'ss pinto beans wake against th', 1),
|
||||
(34, 88362, 871, 1, 13.00, 17554.68, 0.00, 0.07, 'N', 'O', '1998-10-23', '1998-09-14', '1998-11-06', 'NONE', 'REG AIR', 'nic accounts. deposits are alon', 1),
|
||||
(1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, 'N', 'O', '1996-03-13', '1996-02-12', '1996-03-22', 'DELIVER IN PERSON', 'TRUCK', 'egular courts above the', 1),
|
||||
(33, 137469, 9983, 3, 5.00, 7532.30, 0.05, 0.03, 'A', 'F', '1993-12-09', '1993-12-25', '1993-12-23', 'TAKE BACK RETURN', 'AIR', '. stealthily bold exc', 0),
|
||||
(151872, 939, 940, 2, 42.00, 77277.06, 0.01, 0.00, 'N', 'O', '1995-09-30', '1995-09-28', '1995-10-27', 'TAKE BACK RETURN', 'TRUCK', 'ly slyly fina', 1),
|
||||
(77632, 966, 967, 4, 11.00, 20536.56, 0.04, 0.03, 'N', 'O', '1995-09-28', '1995-09-22', '1995-10-24', 'NONE', 'FOB', 'nts was furi', 1),
|
||||
(26439, 1085, 1086, 3, 3.00, 2958.24, 0.03, 0.00, 'N', 'O', '1995-09-30', '1995-12-04', '1995-10-22', 'DELIVER IN PERSON', 'TRUCK', 'ackages wake slyly a', 0),
|
||||
(98599, 1239, 8740, 2, 48.00, 54731.04, 0.09, 0.06, 'N', 'O', '1995-09-24', '1995-08-26', '1995-10-02', 'TAKE BACK RETURN', 'TRUCK', 'ake always p', 1),
|
||||
(95301, 1343, 8844, 2, 33.00, 41063.22, 0.00, 0.01, 'N', 'O', '1995-09-09', '1995-11-01', '1995-09-28', 'TAKE BACK RETURN', 'FOB', 'carefully regular requests. requests', 0),
|
||||
(83008, 2988, 2989, 2, 12.00, 22691.76, 0.06, 0.07, 'N', 'O', '1995-09-15', '1995-09-24', '1995-10-09', 'NONE', 'RAIL', 'into beans do', 1),
|
||||
(117665, 3024, 3025, 4, 10.00, 9270.20, 0.02, 0.01, 'N', 'O', '1995-09-17', '1995-08-26', '1995-10-12', 'COLLECT COD', 'AIR', 'about the slyly even req', 1),
|
||||
(163746, 3126, 8127, 4, 45.00, 46310.40, 0.02, 0.00, 'N', 'O', '1995-09-21', '1995-09-17', '1995-10-01', 'DELIVER IN PERSON', 'RAIL', 'ggle. regular de', 1),
|
||||
(161669, 3142, 8143, 3, 42.00, 43895.88, 0.06, 0.06, 'N', 'O', '1995-09-29', '1995-09-09', '1995-10-29', 'COLLECT COD', 'RAIL', 'ts. unusual accounts gro', 1),
|
||||
(81826, 3357, 8358, 5, 5.00, 6301.75, 0.05, 0.04, 'N', 'O', '1995-09-06', '1995-06-14', '1995-09-19', 'TAKE BACK RETURN', 'FOB', 'y final pains x-ray blithely. pen', 1),
|
||||
(118849, 3625, 6126, 5, 24.00, 36686.88, 0.09, 0.01, 'N', 'O', '1995-09-24', '1995-09-23', '1995-09-27', 'COLLECT COD', 'RAIL', 'c requests. furiously stealthy theodoli', 1),
|
||||
(135239, 4119, 1620, 5, 36.00, 36831.96, 0.05, 0.03, 'N', 'O', '1995-09-06', '1995-07-16', '1995-09-09', 'COLLECT COD', 'AIR', ' after the accounts. qu', 1),
|
||||
(30944, 4466, 9467, 1, 47.00, 64411.62, 0.02, 0.02, 'N', 'O', '1995-09-27', '1995-08-03', '1995-10-11', 'COLLECT COD', 'FOB', 'k platelets nag. slyly regular instructio', 1);
|
||||
CREATE TABLE `part` (
|
||||
`P_PARTKEY` int(11) NOT NULL,
|
||||
`P_NAME` varchar(55) NOT NULL,
|
||||
`P_MFGR` char(25) NOT NULL,
|
||||
`P_BRAND` char(10) NOT NULL,
|
||||
`P_TYPE` varchar(25) NOT NULL,
|
||||
`P_SIZE` int(11) NOT NULL,
|
||||
`P_CONTAINER` char(10) NOT NULL,
|
||||
`P_RETAILPRICE` decimal(15,2) NOT NULL,
|
||||
`P_COMMENT` varchar(23) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
INSERT INTO `part` (
|
||||
`P_PARTKEY`, `P_NAME`, `P_MFGR`, `P_BRAND`, `P_TYPE`,
|
||||
`P_SIZE`, `P_CONTAINER`, `P_RETAILPRICE`, `P_COMMENT`
|
||||
) VALUES
|
||||
(939, 'salmon magenta orange coral aquamarine', 'Manufacturer#1', 'Brand#14', 'PROMO BURNISHED BRASS', 41, 'WRAP PACK', 1839.93, 'ages wake doggedly of'),
|
||||
(966, 'turquoise antique brown violet plum', 'Manufacturer#4', 'Brand#42', 'PROMO BURNISHED TIN', 24, 'MED CAN', 1866.96, ' the carefully'),
|
||||
(1085, 'floral frosted seashell light red', 'Manufacturer#4', 'Brand#45', 'PROMO PLATED COPPER', 26, 'LG CAN', 986.08, 'anent notornis about'),
|
||||
(1239, 'purple dodger lime peach burnished', 'Manufacturer#5', 'Brand#51', 'PROMO BURNISHED STEEL', 24, 'LG CASE', 1140.23, 'structions? quickly i'),
|
||||
(1343, 'navy metallic green cornsilk blue', 'Manufacturer#3', 'Brand#31', 'PROMO BURNISHED TIN', 11, 'WRAP PKG', 1244.34, 'cuses'),
|
||||
(2988, 'medium white firebrick cream sky', 'Manufacturer#3', 'Brand#33', 'PROMO POLISHED COPPER', 3, 'MED DRUM', 1890.98, '. boldly pendin'),
|
||||
(3024, 'lemon burnished goldenrod khaki saddle', 'Manufacturer#1', 'Brand#15', 'PROMO BURNISHED COPPER', 10, 'MED PACK', 927.02, ', eve'),
|
||||
(3126, 'chiffon azure orange seashell blanched', 'Manufacturer#3', 'Brand#34', 'PROMO POLISHED COPPER', 1, 'LG DRUM', 1029.12, 'special dolphins al'),
|
||||
(3142, 'papaya dim beige salmon pink', 'Manufacturer#3', 'Brand#33', 'PROMO BRUSHED STEEL', 50, 'SM CAN', 1045.14, 'quests. slyly'),
|
||||
(3357, 'violet dim metallic lemon spring', 'Manufacturer#3', 'Brand#32', 'PROMO ANODIZED COPPER', 40, 'SM CASE', 1260.35, 'lent pl'),
|
||||
(3625, 'indian peach coral brown linen', 'Manufacturer#5', 'Brand#54', 'PROMO PLATED TIN', 50, 'MED CASE', 1528.62, 'ccounts cajole ca'),
|
||||
(4119, 'blanched salmon gainsboro grey coral', 'Manufacturer#4', 'Brand#43', 'PROMO BRUSHED BRASS', 40, 'JUMBO PACK', 1023.11, 'dependencies wa'),
|
||||
(4466, 'black white chocolate blue drab', 'Manufacturer#2', 'Brand#21', 'PROMO ANODIZED NICKEL', 22, 'SM CAN', 1370.46, 'r the regular braids:'),
|
||||
(88035, 'cornsilk navajo cornflower metallic midnight', 'Manufacturer#4', 'Brand#45', 'PROMO BRUSHED NICKEL', 16, 'JUMBO DRUM', 1023.03, 'ly even theodolites a'),
|
||||
(88362, 'ivory dodger thistle royal olive', 'Manufacturer#2', 'Brand#21', 'ECONOMY POLISHED STEEL', 39, 'WRAP BAG', 1350.36, 'even requests.'),
|
||||
(123927, 'firebrick powder light chiffon violet', 'Manufacturer#1', 'Brand#14', 'MEDIUM PLATED TIN', 41, 'WRAP CAN', 1950.92, 'ackages. blithely'),
|
||||
(128449, 'cream linen salmon smoke blue', 'Manufacturer#2', 'Brand#25', 'STANDARD BURNISHED BRASS', 10, 'WRAP BOX', 1477.44, 'nal, regular inst'),
|
||||
(137469, 'steel royal frosted peru sienna', 'Manufacturer#4', 'Brand#42', 'ECONOMY BURNISHED COPPER', 17, 'LG PKG', 1506.46, 'unts aft'),
|
||||
(155190, 'chocolate lace cornflower rosy light', 'Manufacturer#4', 'Brand#44', 'PROMO BRUSHED NICKEL', 9, 'JUMBO JAR', 1245.19, 'sly unusual orbits use'),
|
||||
(182052, 'blue floral drab yellow dark', 'Manufacturer#5', 'Brand#52', 'MEDIUM PLATED COPPER', 38, 'JUMBO PKG', 1134.05, 'ic, regular foxes. bo'),
|
||||
(197921, 'goldenrod yellow royal salmon linen', 'Manufacturer#5', 'Brand#53', 'MEDIUM BRUSHED BRASS', 10, 'WRAP DRUM', 2018.92, 'r the quickl');
|
||||
set histogram_size=2;
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS(l_orderkey) INDEXES();
|
||||
Table Op Msg_type Msg_text
|
||||
rbo_parallel_ces_tpch.lineitem analyze status Engine-independent statistics collected
|
||||
rbo_parallel_ces_tpch.lineitem analyze status OK
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
select
|
||||
100.00 * sum(case
|
||||
when p_type like 'PROMO%'
|
||||
then l_extendedprice * (1 - l_discount)
|
||||
else 0
|
||||
end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
|
||||
from
|
||||
lineitem,
|
||||
part
|
||||
where
|
||||
l_partkey = p_partkey
|
||||
and l_shipdate >= date '1995-09-01'
|
||||
and l_shipdate < date '1995-09-01' + interval '1' month
|
||||
order by sum(case
|
||||
when p_type like 'PROMO%'
|
||||
then l_extendedprice * (1 - l_discount)
|
||||
else 0
|
||||
end);
|
||||
promo_revenue
|
||||
100.0000000000
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
SET @rbo_rules := mcs_get_plan('rules');
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
rule_parallel_ces_applied
|
||||
1
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
set @rewritten_derived_name = 'derived table - $added_sub_rbo_parallel_ces_tpch_lineitem_0';
|
||||
set @original_table_name = '.lineitem(lineitem/) engineType=ForeignEngine';
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) AS rewritten_derived_table_count;
|
||||
rewritten_derived_table_count
|
||||
1.0000
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @original_table_name, ''))) / CHAR_LENGTH(@original_table_name) AS original_table_count;
|
||||
original_table_count
|
||||
3.0000
|
||||
SELECT calsettrace(0);
|
||||
calsettrace(0)
|
||||
1
|
||||
DROP DATABASE rbo_parallel_ces_tpch;
|
||||
set columnstore_unstable_optimizer=off;
|
||||
set optimizer_switch=default;
|
||||
62
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q14.test
Normal file
62
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q14.test
Normal file
@@ -0,0 +1,62 @@
|
||||
--source ../include/have_columnstore.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../include/functions.inc
|
||||
--source ../include/cross_engine.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces_tpch;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE rbo_parallel_ces_tpch;
|
||||
USE rbo_parallel_ces_tpch;
|
||||
|
||||
# Turn on plan logging to capture CSEP strings
|
||||
SELECT calsettrace(1);
|
||||
|
||||
--source ../include/create_tpch_lineitem.inc
|
||||
--source ../include/create_tpch_part.inc
|
||||
|
||||
set histogram_size=2;
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS(l_orderkey) INDEXES();
|
||||
|
||||
--source ../include/enable_rbo_parallel_ces.inc
|
||||
|
||||
select
|
||||
100.00 * sum(case
|
||||
when p_type like 'PROMO%'
|
||||
then l_extendedprice * (1 - l_discount)
|
||||
else 0
|
||||
end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
|
||||
from
|
||||
lineitem,
|
||||
part
|
||||
where
|
||||
l_partkey = p_partkey
|
||||
and l_shipdate >= date '1995-09-01'
|
||||
and l_shipdate < date '1995-09-01' + interval '1' month
|
||||
order by sum(case
|
||||
when p_type like 'PROMO%'
|
||||
then l_extendedprice * (1 - l_discount)
|
||||
else 0
|
||||
end);
|
||||
|
||||
# Snapshot plans into variables for readability
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
SET @rbo_rules := mcs_get_plan('rules');
|
||||
|
||||
# Ensure rule was applied
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
set @rewritten_derived_name = 'derived table - $added_sub_rbo_parallel_ces_tpch_lineitem_0';
|
||||
set @original_table_name = '.lineitem(lineitem/) engineType=ForeignEngine';
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) AS rewritten_derived_table_count;
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @original_table_name, ''))) / CHAR_LENGTH(@original_table_name) AS original_table_count;
|
||||
|
||||
# Cleanup
|
||||
SELECT calsettrace(0);
|
||||
DROP DATABASE rbo_parallel_ces_tpch;
|
||||
|
||||
--source ../include/disable_rbo_parallel_ces.inc
|
||||
--source ../include/drop_functions.inc
|
||||
--source ../include/drop_cross_engine.inc
|
||||
206
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q20.result
Normal file
206
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q20.result
Normal file
@@ -0,0 +1,206 @@
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces_tpch;
|
||||
CREATE DATABASE rbo_parallel_ces_tpch;
|
||||
USE rbo_parallel_ces_tpch;
|
||||
SELECT calsettrace(1);
|
||||
calsettrace(1)
|
||||
0
|
||||
CREATE TABLE `lineitem` (
|
||||
`L_ORDERKEY` int(11) NOT NULL,
|
||||
`L_PARTKEY` int(11) NOT NULL,
|
||||
`L_SUPPKEY` int(11) NOT NULL,
|
||||
`L_LINENUMBER` int(11) NOT NULL,
|
||||
`L_QUANTITY` decimal(15,2) NOT NULL,
|
||||
`L_EXTENDEDPRICE` decimal(15,2) NOT NULL,
|
||||
`L_DISCOUNT` decimal(15,2) NOT NULL,
|
||||
`L_TAX` decimal(15,2) NOT NULL,
|
||||
`L_RETURNFLAG` char(1) NOT NULL,
|
||||
`L_LINESTATUS` char(1) NOT NULL,
|
||||
`L_SHIPDATE` date NOT NULL,
|
||||
`L_COMMITDATE` date NOT NULL,
|
||||
`L_RECEIPTDATE` date NOT NULL,
|
||||
`L_SHIPINSTRUCT` char(25) NOT NULL,
|
||||
`L_SHIPMODE` char(10) NOT NULL,
|
||||
`L_COMMENT` varchar(44) NOT NULL,
|
||||
`recdate_gt_commitdate` tinyint(4) NOT NULL DEFAULT 0,
|
||||
KEY `L_ORDERKEY` (`L_ORDERKEY`,`L_SUPPKEY`,`recdate_gt_commitdate`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
INSERT INTO `lineitem` (
|
||||
`L_ORDERKEY`, `L_PARTKEY`, `L_SUPPKEY`, `L_LINENUMBER`,
|
||||
`L_QUANTITY`, `L_EXTENDEDPRICE`, `L_DISCOUNT`, `L_TAX`,
|
||||
`L_RETURNFLAG`, `L_LINESTATUS`, `L_SHIPDATE`, `L_COMMITDATE`, `L_RECEIPTDATE`,
|
||||
`L_SHIPINSTRUCT`, `L_SHIPMODE`, `L_COMMENT`, `recdate_gt_commitdate`
|
||||
) VALUES
|
||||
(32, 197921, 441, 2, 32.00, 64605.44, 0.02, 0.00, 'N', 'O', '1995-08-14', '1995-10-07', '1995-08-27', 'COLLECT COD', 'AIR', 'lithely regular deposits. fluffily', 0),
|
||||
(3, 128449, 3474, 3, 27.00, 39890.88, 0.06, 0.07, 'A', 'F', '1994-01-16', '1993-11-22', '1994-01-23', 'DELIVER IN PERSON', 'SHIP', 'nal foxes wake. ', 1),
|
||||
(4, 88035, 5560, 1, 30.00, 30690.90, 0.03, 0.08, 'N', 'O', '1996-01-10', '1995-12-14', '1996-01-18', 'DELIVER IN PERSON', 'REG AIR', '- quickly regular packages sleep. idly', 1),
|
||||
(5, 123927, 3928, 2, 26.00, 50723.92, 0.07, 0.08, 'R', 'F', '1994-10-16', '1994-09-25', '1994-10-19', 'NONE', 'FOB', 'sts use slyly quickly special instruc', 1),
|
||||
(7, 182052, 9607, 1, 12.00, 13608.60, 0.07, 0.03, 'N', 'O', '1996-05-07', '1996-03-13', '1996-06-03', 'TAKE BACK RETURN', 'FOB', 'ss pinto beans wake against th', 1),
|
||||
(34, 88362, 871, 1, 13.00, 17554.68, 0.00, 0.07, 'N', 'O', '1998-10-23', '1998-09-14', '1998-11-06', 'NONE', 'REG AIR', 'nic accounts. deposits are alon', 1),
|
||||
(1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, 'N', 'O', '1996-03-13', '1996-02-12', '1996-03-22', 'DELIVER IN PERSON', 'TRUCK', 'egular courts above the', 1),
|
||||
(33, 137469, 9983, 3, 5.00, 7532.30, 0.05, 0.03, 'A', 'F', '1993-12-09', '1993-12-25', '1993-12-23', 'TAKE BACK RETURN', 'AIR', '. stealthily bold exc', 0),
|
||||
(151872, 939, 940, 2, 42.00, 77277.06, 0.01, 0.00, 'N', 'O', '1995-09-30', '1995-09-28', '1995-10-27', 'TAKE BACK RETURN', 'TRUCK', 'ly slyly fina', 1),
|
||||
(77632, 966, 967, 4, 11.00, 20536.56, 0.04, 0.03, 'N', 'O', '1995-09-28', '1995-09-22', '1995-10-24', 'NONE', 'FOB', 'nts was furi', 1),
|
||||
(26439, 1085, 1086, 3, 3.00, 2958.24, 0.03, 0.00, 'N', 'O', '1995-09-30', '1995-12-04', '1995-10-22', 'DELIVER IN PERSON', 'TRUCK', 'ackages wake slyly a', 0),
|
||||
(98599, 1239, 8740, 2, 48.00, 54731.04, 0.09, 0.06, 'N', 'O', '1995-09-24', '1995-08-26', '1995-10-02', 'TAKE BACK RETURN', 'TRUCK', 'ake always p', 1),
|
||||
(95301, 1343, 8844, 2, 33.00, 41063.22, 0.00, 0.01, 'N', 'O', '1995-09-09', '1995-11-01', '1995-09-28', 'TAKE BACK RETURN', 'FOB', 'carefully regular requests. requests', 0),
|
||||
(83008, 2988, 2989, 2, 12.00, 22691.76, 0.06, 0.07, 'N', 'O', '1995-09-15', '1995-09-24', '1995-10-09', 'NONE', 'RAIL', 'into beans do', 1),
|
||||
(117665, 3024, 3025, 4, 10.00, 9270.20, 0.02, 0.01, 'N', 'O', '1995-09-17', '1995-08-26', '1995-10-12', 'COLLECT COD', 'AIR', 'about the slyly even req', 1),
|
||||
(163746, 3126, 8127, 4, 45.00, 46310.40, 0.02, 0.00, 'N', 'O', '1995-09-21', '1995-09-17', '1995-10-01', 'DELIVER IN PERSON', 'RAIL', 'ggle. regular de', 1),
|
||||
(161669, 3142, 8143, 3, 42.00, 43895.88, 0.06, 0.06, 'N', 'O', '1995-09-29', '1995-09-09', '1995-10-29', 'COLLECT COD', 'RAIL', 'ts. unusual accounts gro', 1),
|
||||
(81826, 3357, 8358, 5, 5.00, 6301.75, 0.05, 0.04, 'N', 'O', '1995-09-06', '1995-06-14', '1995-09-19', 'TAKE BACK RETURN', 'FOB', 'y final pains x-ray blithely. pen', 1),
|
||||
(118849, 3625, 6126, 5, 24.00, 36686.88, 0.09, 0.01, 'N', 'O', '1995-09-24', '1995-09-23', '1995-09-27', 'COLLECT COD', 'RAIL', 'c requests. furiously stealthy theodoli', 1),
|
||||
(135239, 4119, 1620, 5, 36.00, 36831.96, 0.05, 0.03, 'N', 'O', '1995-09-06', '1995-07-16', '1995-09-09', 'COLLECT COD', 'AIR', ' after the accounts. qu', 1),
|
||||
(30944, 4466, 9467, 1, 47.00, 64411.62, 0.02, 0.02, 'N', 'O', '1995-09-27', '1995-08-03', '1995-10-11', 'COLLECT COD', 'FOB', 'k platelets nag. slyly regular instructio', 1);
|
||||
CREATE TABLE `part` (
|
||||
`P_PARTKEY` int(11) NOT NULL,
|
||||
`P_NAME` varchar(55) NOT NULL,
|
||||
`P_MFGR` char(25) NOT NULL,
|
||||
`P_BRAND` char(10) NOT NULL,
|
||||
`P_TYPE` varchar(25) NOT NULL,
|
||||
`P_SIZE` int(11) NOT NULL,
|
||||
`P_CONTAINER` char(10) NOT NULL,
|
||||
`P_RETAILPRICE` decimal(15,2) NOT NULL,
|
||||
`P_COMMENT` varchar(23) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
INSERT INTO `part` (
|
||||
`P_PARTKEY`, `P_NAME`, `P_MFGR`, `P_BRAND`, `P_TYPE`,
|
||||
`P_SIZE`, `P_CONTAINER`, `P_RETAILPRICE`, `P_COMMENT`
|
||||
) VALUES
|
||||
(939, 'salmon magenta orange coral aquamarine', 'Manufacturer#1', 'Brand#14', 'PROMO BURNISHED BRASS', 41, 'WRAP PACK', 1839.93, 'ages wake doggedly of'),
|
||||
(966, 'turquoise antique brown violet plum', 'Manufacturer#4', 'Brand#42', 'PROMO BURNISHED TIN', 24, 'MED CAN', 1866.96, ' the carefully'),
|
||||
(1085, 'floral frosted seashell light red', 'Manufacturer#4', 'Brand#45', 'PROMO PLATED COPPER', 26, 'LG CAN', 986.08, 'anent notornis about'),
|
||||
(1239, 'purple dodger lime peach burnished', 'Manufacturer#5', 'Brand#51', 'PROMO BURNISHED STEEL', 24, 'LG CASE', 1140.23, 'structions? quickly i'),
|
||||
(1343, 'navy metallic green cornsilk blue', 'Manufacturer#3', 'Brand#31', 'PROMO BURNISHED TIN', 11, 'WRAP PKG', 1244.34, 'cuses'),
|
||||
(2988, 'medium white firebrick cream sky', 'Manufacturer#3', 'Brand#33', 'PROMO POLISHED COPPER', 3, 'MED DRUM', 1890.98, '. boldly pendin'),
|
||||
(3024, 'lemon burnished goldenrod khaki saddle', 'Manufacturer#1', 'Brand#15', 'PROMO BURNISHED COPPER', 10, 'MED PACK', 927.02, ', eve'),
|
||||
(3126, 'chiffon azure orange seashell blanched', 'Manufacturer#3', 'Brand#34', 'PROMO POLISHED COPPER', 1, 'LG DRUM', 1029.12, 'special dolphins al'),
|
||||
(3142, 'papaya dim beige salmon pink', 'Manufacturer#3', 'Brand#33', 'PROMO BRUSHED STEEL', 50, 'SM CAN', 1045.14, 'quests. slyly'),
|
||||
(3357, 'violet dim metallic lemon spring', 'Manufacturer#3', 'Brand#32', 'PROMO ANODIZED COPPER', 40, 'SM CASE', 1260.35, 'lent pl'),
|
||||
(3625, 'indian peach coral brown linen', 'Manufacturer#5', 'Brand#54', 'PROMO PLATED TIN', 50, 'MED CASE', 1528.62, 'ccounts cajole ca'),
|
||||
(4119, 'blanched salmon gainsboro grey coral', 'Manufacturer#4', 'Brand#43', 'PROMO BRUSHED BRASS', 40, 'JUMBO PACK', 1023.11, 'dependencies wa'),
|
||||
(4466, 'black white chocolate blue drab', 'Manufacturer#2', 'Brand#21', 'PROMO ANODIZED NICKEL', 22, 'SM CAN', 1370.46, 'r the regular braids:'),
|
||||
(88035, 'cornsilk navajo cornflower metallic midnight', 'Manufacturer#4', 'Brand#45', 'PROMO BRUSHED NICKEL', 16, 'JUMBO DRUM', 1023.03, 'ly even theodolites a'),
|
||||
(88362, 'ivory dodger thistle royal olive', 'Manufacturer#2', 'Brand#21', 'ECONOMY POLISHED STEEL', 39, 'WRAP BAG', 1350.36, 'even requests.'),
|
||||
(123927, 'firebrick powder light chiffon violet', 'Manufacturer#1', 'Brand#14', 'MEDIUM PLATED TIN', 41, 'WRAP CAN', 1950.92, 'ackages. blithely'),
|
||||
(128449, 'cream linen salmon smoke blue', 'Manufacturer#2', 'Brand#25', 'STANDARD BURNISHED BRASS', 10, 'WRAP BOX', 1477.44, 'nal, regular inst'),
|
||||
(137469, 'steel royal frosted peru sienna', 'Manufacturer#4', 'Brand#42', 'ECONOMY BURNISHED COPPER', 17, 'LG PKG', 1506.46, 'unts aft'),
|
||||
(155190, 'chocolate lace cornflower rosy light', 'Manufacturer#4', 'Brand#44', 'PROMO BRUSHED NICKEL', 9, 'JUMBO JAR', 1245.19, 'sly unusual orbits use'),
|
||||
(182052, 'blue floral drab yellow dark', 'Manufacturer#5', 'Brand#52', 'MEDIUM PLATED COPPER', 38, 'JUMBO PKG', 1134.05, 'ic, regular foxes. bo'),
|
||||
(197921, 'goldenrod yellow royal salmon linen', 'Manufacturer#5', 'Brand#53', 'MEDIUM BRUSHED BRASS', 10, 'WRAP DRUM', 2018.92, 'r the quickl');
|
||||
CREATE TABLE `partsupp` (
|
||||
`PS_PARTKEY` int(11) NOT NULL,
|
||||
`PS_SUPPKEY` int(11) NOT NULL,
|
||||
`PS_AVAILQTY` int(11) NOT NULL,
|
||||
`PS_SUPPLYCOST` decimal(15,2) NOT NULL,
|
||||
`PS_COMMENT` varchar(199) NOT NULL,
|
||||
KEY `I1` (`PS_PARTKEY`,`PS_SUPPKEY`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
CREATE TABLE `supplier` (
|
||||
`S_SUPPKEY` int(11) NOT NULL,
|
||||
`S_NAME` char(25) NOT NULL,
|
||||
`S_ADDRESS` varchar(40) NOT NULL,
|
||||
`S_NATIONKEY` int(11) NOT NULL,
|
||||
`S_PHONE` char(15) NOT NULL,
|
||||
`S_ACCTBAL` decimal(15,2) NOT NULL,
|
||||
`S_COMMENT` varchar(101) NOT NULL,
|
||||
KEY `S_NATIONKEY` (`S_NATIONKEY`,`S_SUPPKEY`,`S_NAME`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
CREATE TABLE `nation` (
|
||||
`N_NATIONKEY` int(11) NOT NULL,
|
||||
`N_NAME` char(25) NOT NULL,
|
||||
`N_REGIONKEY` int(11) NOT NULL,
|
||||
`N_COMMENT` varchar(152) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
INSERT INTO `nation` (
|
||||
`N_NATIONKEY`, `N_NAME`, `N_REGIONKEY`, `N_COMMENT`
|
||||
) VALUES
|
||||
(0, 'ALGERIA', 0, ' haggle. carefully final deposits detect slyly agai'),
|
||||
(1, 'ARGENTINA', 1, 'al foxes promise slyly according to the regular accounts. bold requests alon'),
|
||||
(2, 'BRAZIL', 1, 'y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special'),
|
||||
(3, 'CANADA', 1, 'eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold'),
|
||||
(4, 'EGYPT', 4, 'y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d'),
|
||||
(5, 'ETHIOPIA', 0, 'ven packages wake quickly. regu'),
|
||||
(6, 'FRANCE', 3, 'refully final requests. regular, ironi'),
|
||||
(7, 'GERMANY', 3, 'l platelets. regular accounts x-ray: unusual, regular acco'),
|
||||
(8, 'INDIA', 2, 'ss excuses cajole slyly across the packages. deposits print aroun'),
|
||||
(9, 'INDONESIA', 2, ' slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull'),
|
||||
(10, 'IRAN', 4, 'efully alongside of the slyly final dependencies.'),
|
||||
(11, 'IRAQ', 4, 'nic deposits boost atop the quickly final requests? quickly regula'),
|
||||
(12, 'JAPAN', 2, 'ously. final, express gifts cajole a'),
|
||||
(13, 'JORDAN', 4, 'ic deposits are blithely about the carefully regular pa'),
|
||||
(14, 'KENYA', 0, ' pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t'),
|
||||
(15, 'MOROCCO', 0, 'rns. blithely bold courts among the closely regular packages use furiously bold platelets?'),
|
||||
(16, 'MOZAMBIQUE', 0, 's. ironic, unusual asymptotes wake blithely r'),
|
||||
(17, 'PERU', 1, 'platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun'),
|
||||
(18, 'CHINA', 2, 'c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos'),
|
||||
(19, 'ROMANIA', 3, 'ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account'),
|
||||
(20, 'SAUDI ARABIA', 4, 'ts. silent requests haggle. closely express packages sleep across the blithely'),
|
||||
(21, 'VIETNAM', 2, 'hely enticingly express accounts. even, final'),
|
||||
(22, 'RUSSIA', 3, ' requests against the platelets use never according to the quickly regular pint'),
|
||||
(23, 'UNITED KINGDOM', 3, 'eans boost carefully special requests. accounts are. carefull'),
|
||||
(24, 'UNITED STATES', 1, 'y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be');
|
||||
set histogram_size=2;
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS(l_orderkey) INDEXES();
|
||||
Table Op Msg_type Msg_text
|
||||
rbo_parallel_ces_tpch.lineitem analyze status Engine-independent statistics collected
|
||||
rbo_parallel_ces_tpch.lineitem analyze status OK
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
select
|
||||
s_name,
|
||||
s_address
|
||||
from
|
||||
supplier,
|
||||
nation
|
||||
where
|
||||
s_suppkey in (
|
||||
select
|
||||
ps_suppkey
|
||||
from
|
||||
partsupp
|
||||
where
|
||||
ps_partkey in (
|
||||
select
|
||||
p_partkey
|
||||
from
|
||||
part
|
||||
where
|
||||
p_name like 'forest%'
|
||||
)
|
||||
and ps_availqty > (
|
||||
select
|
||||
0.5 * sum(l_quantity)
|
||||
from
|
||||
lineitem
|
||||
where
|
||||
l_partkey = ps_partkey
|
||||
and l_suppkey = ps_suppkey
|
||||
and l_shipdate >= date '1994-01-01'
|
||||
and l_shipdate < date '1994-01-01' + interval '1' year
|
||||
)
|
||||
)
|
||||
and s_nationkey = n_nationkey
|
||||
and n_name = 'CANADA'
|
||||
order by
|
||||
s_name;
|
||||
s_name s_address
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
SET @rbo_rules := mcs_get_plan('rules');
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
rule_parallel_ces_applied
|
||||
1
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
set @rewritten_derived_name = 'derived table - $added_sub_rbo_parallel_ces_tpch_lineitem_0';
|
||||
set @original_table_name = '.lineitem(lineitem/) engineType=ForeignEngine';
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) AS rewritten_derived_table_count;
|
||||
rewritten_derived_table_count
|
||||
1.0000
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @original_table_name, ''))) / CHAR_LENGTH(@original_table_name) AS original_table_count;
|
||||
original_table_count
|
||||
3.0000
|
||||
SELECT calsettrace(0);
|
||||
calsettrace(0)
|
||||
1
|
||||
DROP DATABASE rbo_parallel_ces_tpch;
|
||||
set columnstore_unstable_optimizer=off;
|
||||
set optimizer_switch=default;
|
||||
84
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q20.test
Normal file
84
mysql-test/columnstore/future/rbo_parallel_ces_tpch_q20.test
Normal file
@@ -0,0 +1,84 @@
|
||||
--source ../include/have_columnstore.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../include/functions.inc
|
||||
--source ../include/cross_engine.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS rbo_parallel_ces_tpch;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE rbo_parallel_ces_tpch;
|
||||
USE rbo_parallel_ces_tpch;
|
||||
|
||||
# Turn on plan logging to capture CSEP strings
|
||||
SELECT calsettrace(1);
|
||||
|
||||
--source ../include/create_tpch_lineitem.inc
|
||||
--source ../include/create_tpch_part.inc
|
||||
--source ../include/create_tpch_partsupp.inc
|
||||
--source ../include/create_tpch_supplier.inc
|
||||
--source ../include/create_tpch_nation.inc
|
||||
|
||||
set histogram_size=2;
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS(l_orderkey) INDEXES();
|
||||
|
||||
--source ../include/enable_rbo_parallel_ces.inc
|
||||
|
||||
select
|
||||
s_name,
|
||||
s_address
|
||||
from
|
||||
supplier,
|
||||
nation
|
||||
where
|
||||
s_suppkey in (
|
||||
select
|
||||
ps_suppkey
|
||||
from
|
||||
partsupp
|
||||
where
|
||||
ps_partkey in (
|
||||
select
|
||||
p_partkey
|
||||
from
|
||||
part
|
||||
where
|
||||
p_name like 'forest%'
|
||||
)
|
||||
and ps_availqty > (
|
||||
select
|
||||
0.5 * sum(l_quantity)
|
||||
from
|
||||
lineitem
|
||||
where
|
||||
l_partkey = ps_partkey
|
||||
and l_suppkey = ps_suppkey
|
||||
and l_shipdate >= date '1994-01-01'
|
||||
and l_shipdate < date '1994-01-01' + interval '1' year
|
||||
)
|
||||
)
|
||||
and s_nationkey = n_nationkey
|
||||
and n_name = 'CANADA'
|
||||
order by
|
||||
s_name;
|
||||
|
||||
# Snapshot plans into variables for readability
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
SET @rbo_rules := mcs_get_plan('rules');
|
||||
|
||||
# Ensure rule was applied
|
||||
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
|
||||
|
||||
SET @opt_plan := mcs_get_plan('optimized');
|
||||
set @rewritten_derived_name = 'derived table - $added_sub_rbo_parallel_ces_tpch_lineitem_0';
|
||||
set @original_table_name = '.lineitem(lineitem/) engineType=ForeignEngine';
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) AS rewritten_derived_table_count;
|
||||
SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @original_table_name, ''))) / CHAR_LENGTH(@original_table_name) AS original_table_count;
|
||||
|
||||
# Cleanup
|
||||
SELECT calsettrace(0);
|
||||
DROP DATABASE rbo_parallel_ces_tpch;
|
||||
|
||||
--source ../include/disable_rbo_parallel_ces.inc
|
||||
--source ../include/drop_functions.inc
|
||||
--source ../include/drop_cross_engine.inc
|
||||
48
mysql-test/columnstore/include/create_tpch_lineitem.inc
Normal file
48
mysql-test/columnstore/include/create_tpch_lineitem.inc
Normal file
@@ -0,0 +1,48 @@
|
||||
CREATE TABLE `lineitem` (
|
||||
`L_ORDERKEY` int(11) NOT NULL,
|
||||
`L_PARTKEY` int(11) NOT NULL,
|
||||
`L_SUPPKEY` int(11) NOT NULL,
|
||||
`L_LINENUMBER` int(11) NOT NULL,
|
||||
`L_QUANTITY` decimal(15,2) NOT NULL,
|
||||
`L_EXTENDEDPRICE` decimal(15,2) NOT NULL,
|
||||
`L_DISCOUNT` decimal(15,2) NOT NULL,
|
||||
`L_TAX` decimal(15,2) NOT NULL,
|
||||
`L_RETURNFLAG` char(1) NOT NULL,
|
||||
`L_LINESTATUS` char(1) NOT NULL,
|
||||
`L_SHIPDATE` date NOT NULL,
|
||||
`L_COMMITDATE` date NOT NULL,
|
||||
`L_RECEIPTDATE` date NOT NULL,
|
||||
`L_SHIPINSTRUCT` char(25) NOT NULL,
|
||||
`L_SHIPMODE` char(10) NOT NULL,
|
||||
`L_COMMENT` varchar(44) NOT NULL,
|
||||
`recdate_gt_commitdate` tinyint(4) NOT NULL DEFAULT 0,
|
||||
KEY `L_ORDERKEY` (`L_ORDERKEY`,`L_SUPPKEY`,`recdate_gt_commitdate`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
INSERT INTO `lineitem` (
|
||||
`L_ORDERKEY`, `L_PARTKEY`, `L_SUPPKEY`, `L_LINENUMBER`,
|
||||
`L_QUANTITY`, `L_EXTENDEDPRICE`, `L_DISCOUNT`, `L_TAX`,
|
||||
`L_RETURNFLAG`, `L_LINESTATUS`, `L_SHIPDATE`, `L_COMMITDATE`, `L_RECEIPTDATE`,
|
||||
`L_SHIPINSTRUCT`, `L_SHIPMODE`, `L_COMMENT`, `recdate_gt_commitdate`
|
||||
) VALUES
|
||||
(32, 197921, 441, 2, 32.00, 64605.44, 0.02, 0.00, 'N', 'O', '1995-08-14', '1995-10-07', '1995-08-27', 'COLLECT COD', 'AIR', 'lithely regular deposits. fluffily', 0),
|
||||
(3, 128449, 3474, 3, 27.00, 39890.88, 0.06, 0.07, 'A', 'F', '1994-01-16', '1993-11-22', '1994-01-23', 'DELIVER IN PERSON', 'SHIP', 'nal foxes wake. ', 1),
|
||||
(4, 88035, 5560, 1, 30.00, 30690.90, 0.03, 0.08, 'N', 'O', '1996-01-10', '1995-12-14', '1996-01-18', 'DELIVER IN PERSON', 'REG AIR', '- quickly regular packages sleep. idly', 1),
|
||||
(5, 123927, 3928, 2, 26.00, 50723.92, 0.07, 0.08, 'R', 'F', '1994-10-16', '1994-09-25', '1994-10-19', 'NONE', 'FOB', 'sts use slyly quickly special instruc', 1),
|
||||
(7, 182052, 9607, 1, 12.00, 13608.60, 0.07, 0.03, 'N', 'O', '1996-05-07', '1996-03-13', '1996-06-03', 'TAKE BACK RETURN', 'FOB', 'ss pinto beans wake against th', 1),
|
||||
(34, 88362, 871, 1, 13.00, 17554.68, 0.00, 0.07, 'N', 'O', '1998-10-23', '1998-09-14', '1998-11-06', 'NONE', 'REG AIR', 'nic accounts. deposits are alon', 1),
|
||||
(1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, 'N', 'O', '1996-03-13', '1996-02-12', '1996-03-22', 'DELIVER IN PERSON', 'TRUCK', 'egular courts above the', 1),
|
||||
(33, 137469, 9983, 3, 5.00, 7532.30, 0.05, 0.03, 'A', 'F', '1993-12-09', '1993-12-25', '1993-12-23', 'TAKE BACK RETURN', 'AIR', '. stealthily bold exc', 0),
|
||||
(151872, 939, 940, 2, 42.00, 77277.06, 0.01, 0.00, 'N', 'O', '1995-09-30', '1995-09-28', '1995-10-27', 'TAKE BACK RETURN', 'TRUCK', 'ly slyly fina', 1),
|
||||
(77632, 966, 967, 4, 11.00, 20536.56, 0.04, 0.03, 'N', 'O', '1995-09-28', '1995-09-22', '1995-10-24', 'NONE', 'FOB', 'nts was furi', 1),
|
||||
(26439, 1085, 1086, 3, 3.00, 2958.24, 0.03, 0.00, 'N', 'O', '1995-09-30', '1995-12-04', '1995-10-22', 'DELIVER IN PERSON', 'TRUCK', 'ackages wake slyly a', 0),
|
||||
(98599, 1239, 8740, 2, 48.00, 54731.04, 0.09, 0.06, 'N', 'O', '1995-09-24', '1995-08-26', '1995-10-02', 'TAKE BACK RETURN', 'TRUCK', 'ake always p', 1),
|
||||
(95301, 1343, 8844, 2, 33.00, 41063.22, 0.00, 0.01, 'N', 'O', '1995-09-09', '1995-11-01', '1995-09-28', 'TAKE BACK RETURN', 'FOB', 'carefully regular requests. requests', 0),
|
||||
(83008, 2988, 2989, 2, 12.00, 22691.76, 0.06, 0.07, 'N', 'O', '1995-09-15', '1995-09-24', '1995-10-09', 'NONE', 'RAIL', 'into beans do', 1),
|
||||
(117665, 3024, 3025, 4, 10.00, 9270.20, 0.02, 0.01, 'N', 'O', '1995-09-17', '1995-08-26', '1995-10-12', 'COLLECT COD', 'AIR', 'about the slyly even req', 1),
|
||||
(163746, 3126, 8127, 4, 45.00, 46310.40, 0.02, 0.00, 'N', 'O', '1995-09-21', '1995-09-17', '1995-10-01', 'DELIVER IN PERSON', 'RAIL', 'ggle. regular de', 1),
|
||||
(161669, 3142, 8143, 3, 42.00, 43895.88, 0.06, 0.06, 'N', 'O', '1995-09-29', '1995-09-09', '1995-10-29', 'COLLECT COD', 'RAIL', 'ts. unusual accounts gro', 1),
|
||||
(81826, 3357, 8358, 5, 5.00, 6301.75, 0.05, 0.04, 'N', 'O', '1995-09-06', '1995-06-14', '1995-09-19', 'TAKE BACK RETURN', 'FOB', 'y final pains x-ray blithely. pen', 1),
|
||||
(118849, 3625, 6126, 5, 24.00, 36686.88, 0.09, 0.01, 'N', 'O', '1995-09-24', '1995-09-23', '1995-09-27', 'COLLECT COD', 'RAIL', 'c requests. furiously stealthy theodoli', 1),
|
||||
(135239, 4119, 1620, 5, 36.00, 36831.96, 0.05, 0.03, 'N', 'O', '1995-09-06', '1995-07-16', '1995-09-09', 'COLLECT COD', 'AIR', ' after the accounts. qu', 1),
|
||||
(30944, 4466, 9467, 1, 47.00, 64411.62, 0.02, 0.02, 'N', 'O', '1995-09-27', '1995-08-03', '1995-10-11', 'COLLECT COD', 'FOB', 'k platelets nag. slyly regular instructio', 1);
|
||||
35
mysql-test/columnstore/include/create_tpch_nation.inc
Normal file
35
mysql-test/columnstore/include/create_tpch_nation.inc
Normal file
@@ -0,0 +1,35 @@
|
||||
CREATE TABLE `nation` (
|
||||
`N_NATIONKEY` int(11) NOT NULL,
|
||||
`N_NAME` char(25) NOT NULL,
|
||||
`N_REGIONKEY` int(11) NOT NULL,
|
||||
`N_COMMENT` varchar(152) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
INSERT INTO `nation` (
|
||||
`N_NATIONKEY`, `N_NAME`, `N_REGIONKEY`, `N_COMMENT`
|
||||
) VALUES
|
||||
(0, 'ALGERIA', 0, ' haggle. carefully final deposits detect slyly agai'),
|
||||
(1, 'ARGENTINA', 1, 'al foxes promise slyly according to the regular accounts. bold requests alon'),
|
||||
(2, 'BRAZIL', 1, 'y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special'),
|
||||
(3, 'CANADA', 1, 'eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold'),
|
||||
(4, 'EGYPT', 4, 'y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d'),
|
||||
(5, 'ETHIOPIA', 0, 'ven packages wake quickly. regu'),
|
||||
(6, 'FRANCE', 3, 'refully final requests. regular, ironi'),
|
||||
(7, 'GERMANY', 3, 'l platelets. regular accounts x-ray: unusual, regular acco'),
|
||||
(8, 'INDIA', 2, 'ss excuses cajole slyly across the packages. deposits print aroun'),
|
||||
(9, 'INDONESIA', 2, ' slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull'),
|
||||
(10, 'IRAN', 4, 'efully alongside of the slyly final dependencies.'),
|
||||
(11, 'IRAQ', 4, 'nic deposits boost atop the quickly final requests? quickly regula'),
|
||||
(12, 'JAPAN', 2, 'ously. final, express gifts cajole a'),
|
||||
(13, 'JORDAN', 4, 'ic deposits are blithely about the carefully regular pa'),
|
||||
(14, 'KENYA', 0, ' pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t'),
|
||||
(15, 'MOROCCO', 0, 'rns. blithely bold courts among the closely regular packages use furiously bold platelets?'),
|
||||
(16, 'MOZAMBIQUE', 0, 's. ironic, unusual asymptotes wake blithely r'),
|
||||
(17, 'PERU', 1, 'platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun'),
|
||||
(18, 'CHINA', 2, 'c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos'),
|
||||
(19, 'ROMANIA', 3, 'ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account'),
|
||||
(20, 'SAUDI ARABIA', 4, 'ts. silent requests haggle. closely express packages sleep across the blithely'),
|
||||
(21, 'VIETNAM', 2, 'hely enticingly express accounts. even, final'),
|
||||
(22, 'RUSSIA', 3, ' requests against the platelets use never according to the quickly regular pint'),
|
||||
(23, 'UNITED KINGDOM', 3, 'eans boost carefully special requests. accounts are. carefull'),
|
||||
(24, 'UNITED STATES', 1, 'y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be');
|
||||
37
mysql-test/columnstore/include/create_tpch_part.inc
Normal file
37
mysql-test/columnstore/include/create_tpch_part.inc
Normal file
@@ -0,0 +1,37 @@
|
||||
CREATE TABLE `part` (
|
||||
`P_PARTKEY` int(11) NOT NULL,
|
||||
`P_NAME` varchar(55) NOT NULL,
|
||||
`P_MFGR` char(25) NOT NULL,
|
||||
`P_BRAND` char(10) NOT NULL,
|
||||
`P_TYPE` varchar(25) NOT NULL,
|
||||
`P_SIZE` int(11) NOT NULL,
|
||||
`P_CONTAINER` char(10) NOT NULL,
|
||||
`P_RETAILPRICE` decimal(15,2) NOT NULL,
|
||||
`P_COMMENT` varchar(23) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
INSERT INTO `part` (
|
||||
`P_PARTKEY`, `P_NAME`, `P_MFGR`, `P_BRAND`, `P_TYPE`,
|
||||
`P_SIZE`, `P_CONTAINER`, `P_RETAILPRICE`, `P_COMMENT`
|
||||
) VALUES
|
||||
(939, 'salmon magenta orange coral aquamarine', 'Manufacturer#1', 'Brand#14', 'PROMO BURNISHED BRASS', 41, 'WRAP PACK', 1839.93, 'ages wake doggedly of'),
|
||||
(966, 'turquoise antique brown violet plum', 'Manufacturer#4', 'Brand#42', 'PROMO BURNISHED TIN', 24, 'MED CAN', 1866.96, ' the carefully'),
|
||||
(1085, 'floral frosted seashell light red', 'Manufacturer#4', 'Brand#45', 'PROMO PLATED COPPER', 26, 'LG CAN', 986.08, 'anent notornis about'),
|
||||
(1239, 'purple dodger lime peach burnished', 'Manufacturer#5', 'Brand#51', 'PROMO BURNISHED STEEL', 24, 'LG CASE', 1140.23, 'structions? quickly i'),
|
||||
(1343, 'navy metallic green cornsilk blue', 'Manufacturer#3', 'Brand#31', 'PROMO BURNISHED TIN', 11, 'WRAP PKG', 1244.34, 'cuses'),
|
||||
(2988, 'medium white firebrick cream sky', 'Manufacturer#3', 'Brand#33', 'PROMO POLISHED COPPER', 3, 'MED DRUM', 1890.98, '. boldly pendin'),
|
||||
(3024, 'lemon burnished goldenrod khaki saddle', 'Manufacturer#1', 'Brand#15', 'PROMO BURNISHED COPPER', 10, 'MED PACK', 927.02, ', eve'),
|
||||
(3126, 'chiffon azure orange seashell blanched', 'Manufacturer#3', 'Brand#34', 'PROMO POLISHED COPPER', 1, 'LG DRUM', 1029.12, 'special dolphins al'),
|
||||
(3142, 'papaya dim beige salmon pink', 'Manufacturer#3', 'Brand#33', 'PROMO BRUSHED STEEL', 50, 'SM CAN', 1045.14, 'quests. slyly'),
|
||||
(3357, 'violet dim metallic lemon spring', 'Manufacturer#3', 'Brand#32', 'PROMO ANODIZED COPPER', 40, 'SM CASE', 1260.35, 'lent pl'),
|
||||
(3625, 'indian peach coral brown linen', 'Manufacturer#5', 'Brand#54', 'PROMO PLATED TIN', 50, 'MED CASE', 1528.62, 'ccounts cajole ca'),
|
||||
(4119, 'blanched salmon gainsboro grey coral', 'Manufacturer#4', 'Brand#43', 'PROMO BRUSHED BRASS', 40, 'JUMBO PACK', 1023.11, 'dependencies wa'),
|
||||
(4466, 'black white chocolate blue drab', 'Manufacturer#2', 'Brand#21', 'PROMO ANODIZED NICKEL', 22, 'SM CAN', 1370.46, 'r the regular braids:'),
|
||||
(88035, 'cornsilk navajo cornflower metallic midnight', 'Manufacturer#4', 'Brand#45', 'PROMO BRUSHED NICKEL', 16, 'JUMBO DRUM', 1023.03, 'ly even theodolites a'),
|
||||
(88362, 'ivory dodger thistle royal olive', 'Manufacturer#2', 'Brand#21', 'ECONOMY POLISHED STEEL', 39, 'WRAP BAG', 1350.36, 'even requests.'),
|
||||
(123927, 'firebrick powder light chiffon violet', 'Manufacturer#1', 'Brand#14', 'MEDIUM PLATED TIN', 41, 'WRAP CAN', 1950.92, 'ackages. blithely'),
|
||||
(128449, 'cream linen salmon smoke blue', 'Manufacturer#2', 'Brand#25', 'STANDARD BURNISHED BRASS', 10, 'WRAP BOX', 1477.44, 'nal, regular inst'),
|
||||
(137469, 'steel royal frosted peru sienna', 'Manufacturer#4', 'Brand#42', 'ECONOMY BURNISHED COPPER', 17, 'LG PKG', 1506.46, 'unts aft'),
|
||||
(155190, 'chocolate lace cornflower rosy light', 'Manufacturer#4', 'Brand#44', 'PROMO BRUSHED NICKEL', 9, 'JUMBO JAR', 1245.19, 'sly unusual orbits use'),
|
||||
(182052, 'blue floral drab yellow dark', 'Manufacturer#5', 'Brand#52', 'MEDIUM PLATED COPPER', 38, 'JUMBO PKG', 1134.05, 'ic, regular foxes. bo'),
|
||||
(197921, 'goldenrod yellow royal salmon linen', 'Manufacturer#5', 'Brand#53', 'MEDIUM BRUSHED BRASS', 10, 'WRAP DRUM', 2018.92, 'r the quickl');
|
||||
8
mysql-test/columnstore/include/create_tpch_partsupp.inc
Normal file
8
mysql-test/columnstore/include/create_tpch_partsupp.inc
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE `partsupp` (
|
||||
`PS_PARTKEY` int(11) NOT NULL,
|
||||
`PS_SUPPKEY` int(11) NOT NULL,
|
||||
`PS_AVAILQTY` int(11) NOT NULL,
|
||||
`PS_SUPPLYCOST` decimal(15,2) NOT NULL,
|
||||
`PS_COMMENT` varchar(199) NOT NULL,
|
||||
KEY `I1` (`PS_PARTKEY`,`PS_SUPPKEY`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
10
mysql-test/columnstore/include/create_tpch_supplier.inc
Normal file
10
mysql-test/columnstore/include/create_tpch_supplier.inc
Normal file
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE `supplier` (
|
||||
`S_SUPPKEY` int(11) NOT NULL,
|
||||
`S_NAME` char(25) NOT NULL,
|
||||
`S_ADDRESS` varchar(40) NOT NULL,
|
||||
`S_NATIONKEY` int(11) NOT NULL,
|
||||
`S_PHONE` char(15) NOT NULL,
|
||||
`S_ACCTBAL` decimal(15,2) NOT NULL,
|
||||
`S_COMMENT` varchar(101) NOT NULL,
|
||||
KEY `S_NATIONKEY` (`S_NATIONKEY`,`S_SUPPKEY`,`S_NAME`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
@@ -0,0 +1,2 @@
|
||||
set columnstore_unstable_optimizer=off;
|
||||
set optimizer_switch=default;
|
||||
@@ -0,0 +1,2 @@
|
||||
set columnstore_unstable_optimizer=on;
|
||||
set optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off,sargable_casefold=off";
|
||||
Reference in New Issue
Block a user