~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/conclusions.h

  • Committer: Prafulla Tekawade
  • Date: 2010-07-13 16:07:35 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100713160735-2fsdtrm3azayuyu1
This bug is simillar to mysql bug 36133
http://bugs.mysql.com/bug.php?id=36133

Taking changes from that fix.

  - The problem was that the range optimizer evaluated constant expressions, 
    and among them it would try to evaluate IN-subquery predicates slated for
    handling with materialization strategy. However, these predicates require
    that parent_join->setup_subquery_materialization() is invoked before one
    attempts to evaluate them.
  
  - Fixed by making the range optimizer not to evaluate expressions that have
    item->is_expensive() == TRUE (these are materialization subqueries and 
    stored function calls). This should also resolve the problem that EXPLAIN 
    may be too long. 
    This change cuts off some opportunities for range optimizer, but this is 
    the price we're willing to pay for separation of query optimization and
    execution. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Vijay Samuel
5
 
 *  Copyright (C) 2008 MySQL
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; either version 2 of the License, or
10
 
 *  (at your option) any later version.
11
 
 *
12
 
 *  This program is distributed in the hope that it will be useful,
13
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *  GNU General Public License for more details.
16
 
 *
17
 
 *  You should have received a copy of the GNU General Public License
18
 
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 */
21
 
#ifndef CLIENT_CONCLUSIONS_H
22
 
#define CLIENT_CONCLUSIONS_H
23
 
 
24
 
#include "client_priv.h"
25
 
#include <string>
26
 
#include <iostream>
27
 
 
28
 
class Conclusions 
29
 
{
30
 
 
31
 
public:
32
 
  Conclusions(char *in_engine,
33
 
              long int in_avg_timing,
34
 
              long int in_max_timing,
35
 
              long int in_min_timing,
36
 
              uint32_t in_users,
37
 
              uint32_t in_real_users,
38
 
              uint64_t in_avg_rows,
39
 
              long int in_sum_of_time,
40
 
              long int in_std_dev,
41
 
              long int in_create_avg_timing,
42
 
              long int in_create_max_timing,
43
 
              long int in_create_min_timing,
44
 
              uint64_t in_create_count,
45
 
              uint64_t in_max_rows,
46
 
              uint64_t in_min_rows) :
47
 
    engine(in_engine),
48
 
    avg_timing(in_avg_timing),
49
 
    max_timing(in_max_timing),
50
 
    min_timing(in_min_timing),
51
 
    users(in_users),
52
 
    real_users(in_real_users),
53
 
    avg_rows(in_avg_rows),
54
 
    sum_of_time(in_sum_of_time),
55
 
    std_dev(in_std_dev),
56
 
    create_avg_timing(in_create_avg_timing),
57
 
    create_max_timing(in_create_max_timing),
58
 
    create_min_timing(in_create_min_timing),
59
 
    create_count(in_create_count),
60
 
    max_rows(in_max_rows),
61
 
    min_rows(in_min_rows)
62
 
  { }
63
 
 
64
 
  Conclusions() :
65
 
    engine(NULL),
66
 
    avg_timing(0),
67
 
    max_timing(0),
68
 
    min_timing(0),
69
 
    users(0),
70
 
    real_users(0),
71
 
    avg_rows(0),
72
 
    sum_of_time(0),
73
 
    std_dev(0),
74
 
    create_avg_timing(0),
75
 
    create_max_timing(0),
76
 
    create_min_timing(0),
77
 
    create_count(0),
78
 
    max_rows(0),
79
 
    min_rows(0)
80
 
  { }
81
 
 
82
 
  char *getEngine() const
83
 
  {
84
 
    return engine;
85
 
  }
86
 
  
87
 
  long int getAvgTiming() const
88
 
  {
89
 
    return avg_timing;
90
 
  }
91
 
 
92
 
  long int getMaxTiming() const
93
 
  {
94
 
    return max_timing;
95
 
  }
96
 
 
97
 
  long int getMinTiming() const
98
 
  {
99
 
    return min_timing;
100
 
  }
101
 
 
102
 
  uint32_t getUsers() const
103
 
  {
104
 
    return users;
105
 
  }
106
 
 
107
 
  uint32_t getRealUsers() const
108
 
  {
109
 
    return real_users;
110
 
  }
111
 
 
112
 
  uint64_t getAvgRows() const
113
 
  {
114
 
    return avg_rows;
115
 
  }   
116
 
 
117
 
  long int getSumOfTime() const
118
 
  {
119
 
    return sum_of_time;
120
 
  }
121
 
 
122
 
  long int getStdDev() const
123
 
  {
124
 
    return std_dev;
125
 
  }
126
 
 
127
 
  long int getCreateAvgTiming() const
128
 
  {
129
 
    return create_avg_timing;
130
 
  }
131
 
 
132
 
  long int getCreateMaxTiming() const
133
 
  {
134
 
    return create_max_timing;
135
 
  }
136
 
 
137
 
  long int getCreateMinTiming() const
138
 
  {
139
 
    return create_min_timing;
140
 
  }
141
 
   
142
 
  uint64_t getCreateCount() const
143
 
  {
144
 
    return create_count;
145
 
  }
146
 
 
147
 
  uint64_t getMinRows() const
148
 
  {
149
 
    return min_rows;
150
 
  }
151
 
 
152
 
  uint64_t getMaxRows() const
153
 
  {
154
 
    return max_rows;
155
 
  }
156
 
 
157
 
  void setEngine(char *in_engine) 
158
 
  {
159
 
    engine= in_engine;
160
 
  }
161
 
  
162
 
  void setAvgTiming(long int in_avg_timing) 
163
 
  {
164
 
    avg_timing= in_avg_timing;
165
 
  }
166
 
 
167
 
  void setMaxTiming(long int in_max_timing) 
168
 
  {
169
 
    max_timing= in_max_timing;
170
 
  }
171
 
 
172
 
  void setMinTiming(long int in_min_timing) 
173
 
  {
174
 
    min_timing= in_min_timing;
175
 
  }
176
 
 
177
 
  void setUsers(uint32_t in_users) 
178
 
  {
179
 
    users= in_users;
180
 
  }
181
 
 
182
 
  void setRealUsers(uint32_t in_real_users) 
183
 
  {
184
 
    real_users= in_real_users;
185
 
  }
186
 
 
187
 
  void setAvgRows(uint64_t in_avg_rows) 
188
 
  {
189
 
    avg_rows= in_avg_rows;
190
 
  }   
191
 
 
192
 
  void setSumOfTime(long int in_sum_of_time) 
193
 
  {
194
 
    sum_of_time= in_sum_of_time;
195
 
  }
196
 
 
197
 
  void setStdDev(long int in_std_dev) 
198
 
  {
199
 
    std_dev= in_std_dev;
200
 
  }
201
 
 
202
 
  void setCreateAvgTiming(long int in_create_avg_timing) 
203
 
  {
204
 
    create_avg_timing= in_create_avg_timing;
205
 
  }
206
 
 
207
 
  void setCreateMaxTiming(long int in_create_max_timing) 
208
 
  {
209
 
    create_max_timing= in_create_max_timing;
210
 
  }
211
 
 
212
 
  void setCreateMinTiming(long int in_create_min_timing) 
213
 
  {
214
 
    create_min_timing= in_create_min_timing;
215
 
  }
216
 
   
217
 
  void setCreateCount(uint64_t in_create_count) 
218
 
  {
219
 
    create_count= in_create_count;
220
 
  }
221
 
 
222
 
  void setMinRows(uint64_t in_min_rows) 
223
 
  {
224
 
    min_rows= in_min_rows;
225
 
  }
226
 
 
227
 
  void setMaxRows(uint64_t in_max_rows) 
228
 
  {
229
 
    max_rows= in_max_rows;
230
 
  }
231
 
 
232
 
private:
233
 
  char *engine;
234
 
  long int avg_timing;
235
 
  long int max_timing;
236
 
  long int min_timing;
237
 
  uint32_t users;
238
 
  uint32_t real_users;
239
 
  uint64_t avg_rows;
240
 
  long int sum_of_time;
241
 
  long int std_dev;
242
 
  /* These are just for create time stats */
243
 
  long int create_avg_timing;
244
 
  long int create_max_timing;
245
 
  long int create_min_timing;
246
 
  uint64_t create_count;
247
 
  /* The following are not used yet */
248
 
  uint64_t max_rows;
249
 
  uint64_t min_rows;
250
 
};
251
 
 
252
 
#endif /* CLIENT_CONCLUSIONS_H */