~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/range_param.h

  • Committer: Brian Aker
  • Date: 2010-10-08 14:22:02 UTC
  • mfrom: (1802.16.21 bug621875)
  • mto: This revision was merged to the branch mainline in revision 1824.
  • Revision ID: brian@tangent.org-20101008142202-96maf31n9odkc13n
Merge Padraig

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_OPTIMIZER_RANGE_PARAM_H
21
21
#define DRIZZLED_OPTIMIZER_RANGE_PARAM_H
22
22
 
 
23
#include <boost/dynamic_bitset.hpp>
 
24
 
23
25
#include "drizzled/field.h"
24
26
 
25
27
namespace drizzled
31
33
namespace optimizer
32
34
{
33
35
 
 
36
class RorScanInfo
 
37
{
 
38
public:
 
39
  RorScanInfo()
 
40
    :
 
41
      idx(0),
 
42
      keynr(0),
 
43
      records(0), 
 
44
      sel_arg(NULL),
 
45
      covered_fields(0),
 
46
      covered_fields_size(0),
 
47
      used_fields_covered(0),
 
48
      key_rec_length(0),
 
49
      index_read_cost(0.0),
 
50
      first_uncovered_field(0),
 
51
      key_components(0)
 
52
  {}
 
53
 
 
54
  boost::dynamic_bitset<> bitsToBitset() const;
 
55
 
 
56
  void subtractBitset(const boost::dynamic_bitset<>& in_bitset);
 
57
 
 
58
  uint32_t findFirstNotSet() const; 
 
59
 
 
60
  size_t getBitCount() const;
 
61
 
 
62
  uint32_t      idx;      /* # of used key in param->keys */
 
63
  uint32_t      keynr;    /* # of used key in table */
 
64
  ha_rows   records;  /* estimate of # records this scan will return */
 
65
 
 
66
  /* Set of intervals over key fields that will be used for row retrieval. */
 
67
  optimizer::SEL_ARG   *sel_arg;
 
68
 
 
69
  /* Fields used in the query and covered by this ROR scan. */
 
70
  uint64_t covered_fields;
 
71
  size_t covered_fields_size;
 
72
  uint32_t      used_fields_covered; /* # of set bits in covered_fields */
 
73
  int       key_rec_length; /* length of key record (including rowid) */
 
74
 
 
75
  /*
 
76
    Cost of reading all index records with values in sel_arg intervals set
 
77
    (assuming there is no need to access full table records)
 
78
  */
 
79
  double    index_read_cost;
 
80
  uint32_t      first_uncovered_field; /* first unused bit in covered_fields */
 
81
  uint32_t      key_components; /* # of parts in the key */
 
82
};
 
83
 
34
84
class RangeParameter
35
85
{
36
86
public:
101
151
      max_key_part(0),
102
152
      range_count(0),
103
153
      quick(false),
104
 
      fields_bitmap_size(0),
105
154
      needed_fields(),
106
155
      tmp_covered_fields(),
107
156
      needed_reg(NULL),
119
168
  unsigned char max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
120
169
  bool quick; // Don't calulate possible keys
121
170
 
122
 
  uint32_t fields_bitmap_size;
123
 
  MyBitmap needed_fields;    /* bitmask of fields needed by the query */
124
 
  MyBitmap tmp_covered_fields;
 
171
  boost::dynamic_bitset<> needed_fields;    /* bitmask of fields needed by the query */
 
172
  boost::dynamic_bitset<> tmp_covered_fields;
125
173
 
126
174
  key_map *needed_reg;        /* ptr to SqlSelect::needed_reg */
127
175