summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-12-14 04:56:54 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-12-14 04:56:54 +0400
commitefb57a8ebf798eee816981488c901539ec9fcdad (patch)
treef546fc6f31e98157b7463b55a8b240765b559eb2 /sql/item_subselect.h
parent7229af3034872b4f19122ff3d2492a3fd0a0d773 (diff)
parent05e0127478c39437be53668f0db1d674071e2485 (diff)
downloadmariadb-git-efb57a8ebf798eee816981488c901539ec9fcdad.tar.gz
Merge
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index fbd70a04054..60ca851c881 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -448,11 +448,44 @@ public:
Same as above, but they also allow to scan the materialized table.
*/
bool sjm_scan_allowed;
+
+ /*
+ JoinTaB Materialization (JTBM) members
+ */
+
+ /*
+ TRUE <=> This subselect has been converted into non-mergeable semi-join
+ table.
+ */
+ bool is_jtbm_merged;
+
+ /* (Applicable if is_jtbm_merged==TRUE) Time required to run the materialized join */
double jtbm_read_time;
+
+ /* (Applicable if is_jtbm_merged==TRUE) Number of output rows in materialized join */
double jtbm_record_count;
- bool is_jtbm_merged;
- bool is_jtbm_const_tab;
+
+ /*
+ (Applicable if is_jtbm_merged==TRUE) TRUE <=> The materialized subselect is
+ a degenerate subselect which produces 0 or 1 rows, which we know at
+ optimization phase.
+ Examples:
+ 1. subquery has "Impossible WHERE":
+
+ SELECT * FROM ot WHERE ot.column IN (SELECT it.col FROM it WHERE 2 > 3)
+
+ 2. Subquery produces one row which opt_sum.cc is able to get with one lookup:
+ SELECT * FROM ot WHERE ot.column IN (SELECT MAX(it.key_col) FROM it)
+ */
+ bool is_jtbm_const_tab;
+
+ /*
+ (Applicable if is_jtbm_const_tab==TRUE) Whether the subquery has produced
+ the row (or not)
+ */
+ bool jtbm_const_row_found;
+
/*
TRUE<=>this is a flattenable semi-join, false overwise.
*/
@@ -744,6 +777,9 @@ public:
friend class subselect_hash_sj_engine;
friend class Item_in_subselect;
+ friend bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
+ Item **join_where);
+
};