~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_tab.h

  • Committer: Brian Aker
  • Date: 2009-06-11 22:06:29 UTC
  • mfrom: (1055.2.24 working)
  • Revision ID: brian@gaz-20090611220629-ct55qcmaiiuxrjaq
Merge Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#ifndef DRIZZLED_JOIN_TAB_H
29
29
#define DRIZZLED_JOIN_TAB_H
30
30
 
 
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
 
36
 
31
37
typedef struct st_join_table 
32
38
{
33
 
  st_join_table() {}                          /* Remove gcc warning */
 
39
  st_join_table() {} /* Remove gcc warning */
34
40
  Table *table;
35
 
  KEYUSE *keyuse;                       /**< pointer to first used key */
 
41
  KEYUSE *keyuse; /**< pointer to first used key */
36
42
  SQL_SELECT *select;
37
43
  COND *select_cond;
38
44
  QUICK_SELECT_I *quick;
39
 
  /*
 
45
  /**
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.
71
77
  */
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 */
79
85
 
80
 
  /* Either #rows in the table or 1 for const table.  */
 
86
  /** Either #rows in the table or 1 for const table.  */
81
87
  ha_rows       records;
82
 
  /*
 
88
  /**
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)
85
91
  */
86
92
  ha_rows found_records;
87
 
  /*
 
93
  /**
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.
91
97
  */
92
98
  ha_rows read_time;
93
99
 
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;
98
 
  enum join_type type;
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
 
  bool          sorted;
102
 
  /*
 
100
  table_map     dependent;
 
101
  table_map key_dependent;
 
102
  uint32_t use_quick;
 
103
  uint32_t index;
 
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;
 
110
  bool eq_ref_table;
 
111
  bool not_used_in_distinct;
 
112
  /** True if index-based access method must return records in order */
 
113
  bool sorted;
 
114
  /**
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.
108
120
  TABLE_REF     ref;
109
121
  JOIN_CACHE cache;
110
122
  JOIN *join;
111
 
  /** Bitmap of nested joins this table is part of */
112
123
 
113
 
  /* SemiJoinDuplicateElimination variables: */
114
 
  /*
 
124
  /**
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.
117
127
  */
118
128
  TableList *emb_sj_nest;
119
129
 
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;
124
134
 
125
 
  /*
 
135
  /**
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.
128
138
 
129
139
     NULL - Not an insideout scan.
130
140
  */
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 */
133
143
 
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;
136
146
 
137
 
  enum {
 
147
  enum 
 
148
  {
138
149
    /* If set, the rowid of this table must be put into the temptable. */
139
150
    KEEP_ROWID=1,
140
151
    /*
145
156
    */
146
157
    CALL_POSITION=2
147
158
  };
148
 
  /* A set of flags from the above enum */
 
159
  /** A set of flags from the above enum */
149
160
  int rowid_keep_flags;
150
161
 
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;
153
164
 
154
165
  void cleanup();