summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index bb9d82a7039..3553ee78c5b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8296,6 +8296,11 @@ choose_plan(JOIN *join, table_map join_tables)
jtab_sort_func, (void*)join->emb_sjm_nest);
Json_writer_object wrapper(thd);
+
+ if (join->conds)
+ wrapper.add("cardinality_accurate",
+ join->conds->with_accurate_selectivity_estimation());
+
Json_writer_array trace_plan(thd,"considered_execution_plans");
if (!join->emb_sjm_nest)
@@ -29449,6 +29454,38 @@ void unpack_to_base_table_fields(TABLE *table)
}
+
+/*
+ @brief
+ Checks if a predicate is a range predicate with a constant part
+
+ @param
+
+ @item the item referring to the field of the table
+ @value the item referring to the expression on the
+ rhs of a predicate
+
+ @details
+ Range predicate is defined as the form of field op const
+ where op can be operators like </<=/=/>/>=/BETWEEN etc.
+ Also the statistics for the field should be available via
+ an index or statistical tables.
+
+ @retval
+ TRUE : Success
+ FALSE : Otherwise
+*/
+
+bool is_range_predicate(Item *item, Item *value)
+{
+ Item *field= item->real_item();
+ if (field->type() == Item::FIELD_ITEM && !field->const_item() &&
+ (!value || !value->is_expensive()))
+ return true;
+ return false;
+}
+
+
/**
@} (end of group Query_Optimizer)
*/