28
28
#ifndef DRIZZLED_JOIN_TAB_H
29
29
#define DRIZZLED_JOIN_TAB_H
31
/* Values for JOIN_TAB::packed_info */
32
#define TAB_INFO_HAVE_VALUE 1
33
#define TAB_INFO_USING_INDEX 2
34
#define TAB_INFO_USING_WHERE 4
35
#define TAB_INFO_FULL_SCAN_ON_NULL 8
31
37
typedef struct st_join_table
33
st_join_table() {} /* Remove gcc warning */
39
st_join_table() {} /* Remove gcc warning */
35
KEYUSE *keyuse; /**< pointer to first used key */
41
KEYUSE *keyuse; /**< pointer to first used key */
36
42
SQL_SELECT *select;
38
44
QUICK_SELECT_I *quick;
40
46
The value of select_cond before we've attempted to do Index Condition
41
47
Pushdown. We may need to restore everything back if we first choose one
42
48
index but then reconsider (see test_if_skip_sort_order() for such
69
75
if it is executed by an alternative full table scan when the left operand of
70
76
the subquery predicate is evaluated to NULL.
72
Read_record_func save_read_first_record;/* to save read_first_record */
73
int (*save_read_record) (READ_RECORD *);/* to save read_record.read_record */
78
Read_record_func save_read_first_record; /**< to save read_first_record */
79
int (*save_read_record) (READ_RECORD *); /**< to save read_record.read_record */
74
80
double worst_seeks;
75
key_map const_keys; /**< Keys with constant part */
76
key_map checked_keys; /**< Keys checked in find_best */
81
key_map const_keys; /**< Keys with constant part */
82
key_map checked_keys; /**< Keys checked in find_best */
77
83
key_map needed_reg;
78
key_map keys; /**< all keys with can be used */
84
key_map keys; /**< all keys with can be used */
80
/* Either #rows in the table or 1 for const table. */
86
/** Either #rows in the table or 1 for const table. */
83
89
Number of records that will be scanned (yes scanned, not returned) by the
84
90
best 'independent' access method, i.e. table scan or QUICK_*_SELECT)
86
92
ha_rows found_records;
88
94
Cost of accessing the table using "ALL" or range/index_merge access
89
95
method (but not 'index' for some reason), i.e. this matches method which
90
96
E(#records) is in found_records.
94
table_map dependent,key_dependent;
95
uint32_t use_quick,index;
96
uint32_t status; ///< Save status for cache
97
uint used_fields,used_fieldlength,used_blobs;
99
bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct;
100
/* true <=> index-based access method must return records in order */
101
table_map key_dependent;
104
uint32_t status; /**< Save status for cache */
105
uint32_t used_fields; /**< Number of used fields in join set */
106
uint32_t used_fieldlength; /**< Not sure... */
107
uint32_t used_blobs; /**< Number of BLOB fields in join set */
108
enum join_type type; /**< Access pattern or join type... */
109
bool cached_eq_ref_table;
111
bool not_used_in_distinct;
112
/** True if index-based access method must return records in order */
103
115
If it's not 0 the number stored this field indicates that the index
104
116
scan has been chosen to access the table data and we expect to scan
105
117
this number of rows for the table.
109
121
JOIN_CACHE cache;
111
/** Bitmap of nested joins this table is part of */
113
/* SemiJoinDuplicateElimination variables: */
115
125
Embedding SJ-nest (may be not the direct parent), or NULL if none.
116
126
This variable holds the result of table pullout.
118
128
TableList *emb_sj_nest;
120
/* Variables for semi-join duplicate elimination */
130
/** Variables for semi-join duplicate elimination */
121
131
SJ_TMP_TABLE *flush_weedout_table;
122
132
SJ_TMP_TABLE *check_weed_out_table;
123
133
struct st_join_table *do_firstmatch;
126
136
ptr - this join tab should do an InsideOut scan. Points
127
137
to the tab for which we'll need to check tab->found_match.
129
139
NULL - Not an insideout scan.
131
141
struct st_join_table *insideout_match_tab;
132
unsigned char *insideout_buf; // Buffer to save index tuple to be able to skip dups
142
unsigned char *insideout_buf; /**< Buffer to save index tuple to be able to skip dups */
134
/* Used by InsideOut scan. Just set to true when have found a row. */
144
/** Used by InsideOut scan. Just set to true when have found a row. */
135
145
bool found_match;
138
149
/* If set, the rowid of this table must be put into the temptable. */
148
/* A set of flags from the above enum */
159
/** A set of flags from the above enum */
149
160
int rowid_keep_flags;
151
/* NestedOuterJoins: Bitmap of nested joins this table is part of */
162
/** Bitmap of nested joins this table is part of */
152
163
nested_join_map embedding_map;