1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems, Inc.
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_SARGABLE_PARAM_H
21
#define DRIZZLED_OPTIMIZER_SARGABLE_PARAM_H
29
* SARG stands for search argument. A sargable predicate is one of the form
30
* (or which can be put in to the form) "column comparison-operator value".
31
* SARGS are expressed as a boolean expression of such predicates in
32
* disjunctive normal form. For more information, consult the original paper
33
* in which this term was introduced: Access Path Selection in a Relational
34
* Database Management System by Selinger et al
36
* This class is used to collect info on potentially sargable predicates in
37
* order to check whether they become sargable after reading const tables.
38
* We form a bitmap of indexes that can be used for sargable predicates.
39
* Only such indexes are involved in range analysis.
51
SargableParam(Field *in_field,
53
uint32_t in_num_values)
56
arg_value(in_arg_value),
57
num_values(in_num_values)
60
SargableParam(const SargableParam &rhs)
63
arg_value(rhs.arg_value),
64
num_values(rhs.num_values)
67
SargableParam &operator=(const SargableParam &rhs)
74
arg_value= rhs.arg_value;
75
num_values= rhs.num_values;
84
uint32_t getNumValues() const
89
bool isConstItem(uint32_t index)
91
return (arg_value[index]->const_item());
97
* Field agsinst which to check sargability.
102
* Values of potential keys for lookups.
107
* Number of values in the arg_value array.
112
} /* end namespace optimizer */
114
} /* end namespace drizzled */
116
#endif /* DRIZZLED_OPTIMIZER_SARGABLE_PARAM_H */