1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008-2009 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_OPTIMIZER_RANGE_PARAM_H
21
#define DRIZZLED_OPTIMIZER_RANGE_PARAM_H
23
#include "drizzled/field.h"
28
typedef class Item COND;
29
typedef struct st_key_part KEY_PART;
51
using_real_indexes(false),
52
remove_jump_scans(false),
54
force_default_mrr(false)
57
Session *session; /* Current thread handle */
58
Table *table; /* Table being analyzed */
59
COND *cond; /* Used inside get_mm_tree(). */
60
table_map prev_tables;
61
table_map read_tables;
62
table_map current_table; /* Bit of the table being analyzed */
64
/* Array of parts of all keys for which range analysis is performed */
66
KEY_PART *key_parts_end;
67
memory::Root *mem_root; /* Memory that will be freed when range analysis completes */
68
memory::Root *old_root; /* Memory that will last until the query end */
70
Number of indexes used in range analysis (In SEL_TREE::keys only first
71
#keys elements are not empty)
76
If true, the index descriptions describe real indexes (and it is ok to
77
call field->optimize_range(real_keynr[...], ...).
78
Otherwise index description describes fake indexes.
80
bool using_real_indexes;
82
bool remove_jump_scans;
85
used_key_no -> table_key_no translation table. Only makes sense if
86
using_real_indexes==true
88
uint32_t real_keynr[MAX_KEY];
89
/* Number of SEL_ARG objects allocated by optimizer::SEL_ARG::clone_tree operations */
90
uint32_t alloced_sel_args;
91
bool force_default_mrr;
94
class Parameter : public RangeParameter
104
fields_bitmap_size(0),
106
tmp_covered_fields(),
108
imerge_cost_buff(NULL),
109
imerge_cost_buff_size(0),
114
KEY_PART *key[MAX_KEY]; /* First key parts of keys used in the query */
115
uint32_t max_key_part;
116
/* Number of ranges in the last checked tree->key */
117
uint32_t range_count;
118
unsigned char min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
119
unsigned char max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
120
bool quick; // Don't calulate possible keys
122
uint32_t fields_bitmap_size;
123
MyBitmap needed_fields; /* bitmask of fields needed by the query */
124
MyBitmap tmp_covered_fields;
126
key_map *needed_reg; /* ptr to SqlSelect::needed_reg */
128
uint32_t *imerge_cost_buff; /* buffer for index_merge cost estimates */
129
uint32_t imerge_cost_buff_size; /* size of the buffer */
131
/* true if last checked tree->key can be used for ROR-scan */
133
/* Number of ranges in the last checked tree->key */
137
} /* namespace optimizer */
139
} /* namespace drizzled */
141
#endif /* DRIZZLED_OPTIMIZER_RANGE_PARAM_H */