summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-04-05 02:42:23 +0400
committerunknown <sergefp@mysql.com>2005-04-05 02:42:23 +0400
commit31f2f9bcf8aab6af890acca6bf04e6046e99b2f5 (patch)
treec00712c5e6d5275f9123b529dde218f35ce2dbd7 /sql/sql_select.h
parent11b64a4ec964bf252b2e26261edd376a5f1d3a0c (diff)
downloadmariadb-git-31f2f9bcf8aab6af890acca6bf04e6046e99b2f5.tar.gz
Fix for BUG#8877: Implementation of
"Early NULL-values filtering for ref access" (attempt2+post-review fixes) 1. update_ref_and_keys() accumulates info about null-rejecting predicates in in KEY_FIELD::null_rejecting, add_key_part saves these to KEYUSE. 2. create_ref_for_key copies them to TABLE_REF. 3. add_not_null_conds adds "x IS NOT NULL" to join_tab->select_cond of appropiate JOIN_TAB members. Includes code cleanups: * add_key_field() params: s/COND/Item_func/ (as only Item_funcs are passed to it) * add_key_fields() params: JOIN_TAB *stat removed (wasn't used) sql/sql_select.cc: Fix for BUG#8877: Implementation of "Early NULL-values filtering for ref access" 1. update_ref_and_keys() accumulates info about null-rejecting predicates in in KEY_FIELD::null_rejecting, add_key_part saves these to KEYUSE. 2. create_ref_for_key copies them to TABLE_REF. 3. add_not_null_conds adds "x IS NOT NULL" to join_tab->select_cond of appropiate JOIN_TAB members. Includes code cleanups: * add_key_field() params: s/COND/Item_func/ (as only Item_funcs are passed to it) * add_key_fields() params: JOIN_TAB *stat removed (wasn't used) sql/sql_select.h: Fix for BUG#8877: Implementation of "Early NULL-values filtering for ref access" (attempt2)
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4ea7e1b23e7..ab3b442ef74 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -31,6 +31,11 @@ typedef struct keyuse_t {
uint key, keypart, optimize;
key_part_map keypart_map;
ha_rows ref_table_rows;
+ /*
+ If true, the comparison this value was created from will not be
+ satisfied if val has NULL 'value'.
+ */
+ bool null_rejecting;
} KEYUSE;
class store_key;
@@ -45,6 +50,11 @@ typedef struct st_table_ref
byte *key_buff2; // key_buff+key_length
store_key **key_copy; //
Item **items; // val()'s for each keypart
+ /*
+ (null_rejecting & (1<<i)) means the condition is '=' and no matching
+ rows will be produced if items[i] IS NULL (see add_not_null_conds())
+ */
+ key_part_map null_rejecting;
table_map depend_map; // Table depends on these tables.
byte *null_ref_key; // null byte position in the key_buf.
// used for REF_OR_NULL optimization.