drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
position.h
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
*
4
* Copyright (C) 2009 Sun Microsystems, Inc.
5
*
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.
9
*
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.
14
*
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
18
*/
19
20
#pragma once
21
22
#include <
drizzled/join_table.h
>
23
24
namespace
drizzled
25
{
26
namespace
optimizer
27
{
28
33
class
Position
34
{
35
public
:
36
37
Position()
38
:
39
records_read
(0),
40
read_time
(0),
41
table(NULL),
42
key
(NULL),
43
ref_depend_map
(0)
44
{}
45
46
Position(
double
in_records_read,
47
double
in_read_time,
48
JoinTable
*in_table,
49
KeyUse
*in_key,
50
table_map in_ref_depend_map)
51
:
52
records_read
(in_records_read),
53
read_time
(in_read_time),
54
table(in_table),
55
key
(in_key),
56
ref_depend_map
(in_ref_depend_map)
57
{}
58
59
Position(
const
Position &rhs)
60
:
61
records_read
(rhs.
records_read
),
62
read_time
(rhs.
read_time
),
63
table(rhs.table),
64
key
(rhs.
key
),
65
ref_depend_map
(rhs.
ref_depend_map
)
66
{}
67
68
Position &operator=(
const
Position &rhs)
69
{
70
if
(
this
== &rhs)
71
{
72
return
*
this
;
73
}
74
records_read
= rhs.
records_read
;
75
read_time
= rhs.
read_time
;
76
table= rhs.table;
77
key
= rhs.
key
;
78
ref_depend_map
= rhs.
ref_depend_map
;
79
return
*
this
;
80
}
81
96
bool
isConstTable
()
const
97
{
98
return
(
records_read
< 2.0);
99
}
100
101
double
getFanout()
const
102
{
103
return
records_read
;
104
}
105
106
void
setFanout(
double
in_records_read)
107
{
108
records_read
= in_records_read;
109
}
110
111
double
getCost()
const
112
{
113
return
read_time
;
114
}
115
116
JoinTable *getJoinTable()
117
{
118
return
table;
119
}
120
128
bool
hasTableForSorting
(
Table
*cmp_table)
const
129
{
130
return
(cmp_table != table->table);
131
}
132
133
bool
examinePosition(table_map found_ref);
134
135
KeyUse
*getKeyUse()
136
{
137
return
key
;
138
}
139
140
table_map getRefDependMap()
const
141
{
142
return
ref_depend_map
;
143
}
144
145
void
clearRefDependMap()
146
{
147
ref_depend_map
= 0;
148
}
149
150
private
:
151
157
double
records_read
;
158
164
double
read_time
;
165
166
JoinTable
*table;
167
172
KeyUse
*
key
;
173
175
table_map
ref_depend_map
;
176
177
};
178
179
}
/* end namespace optimizer */
180
181
}
/* end namespace drizzled */
182
drizzled::JoinTable
Definition
join_table.h:68
drizzled::Table
Definition
drizzled/table.h:71
drizzled::optimizer::KeyUse
Definition
key_use.h:28
drizzled::optimizer::Position::isConstTable
bool isConstTable() const
Definition
position.h:96
drizzled::optimizer::Position::ref_depend_map
table_map ref_depend_map
Definition
position.h:175
drizzled::optimizer::Position::hasTableForSorting
bool hasTableForSorting(Table *cmp_table) const
Definition
position.h:128
drizzled::optimizer::Position::read_time
double read_time
Definition
position.h:164
drizzled::optimizer::Position::records_read
double records_read
Definition
position.h:157
drizzled::optimizer::Position::key
KeyUse * key
Definition
position.h:172
join_table.h
drizzled
TODO: Rename this file - func.h is stupid.
Definition
abort_exception.h:27
← Back to Drizzle docs
drizzled
optimizer
position.h
Generated by
1.15.0