Drizzled Public API Documentation

drizzled::optimizer::QuickRorIntersectSelect Class Reference

#include <quick_ror_intersect_select.h>

Inheritance diagram for drizzled::optimizer::QuickRorIntersectSelect:
drizzled::optimizer::QuickSelectInterface

List of all members.

Public Types

enum  {
  QS_TYPE_RANGE = 0, QS_TYPE_INDEX_MERGE = 1, QS_TYPE_RANGE_DESC = 2, QS_TYPE_ROR_INTERSECT = 4,
  QS_TYPE_ROR_UNION = 5, QS_TYPE_GROUP_MIN_MAX = 6
}

Public Member Functions

 QuickRorIntersectSelect (Session *session, Table *table, bool retrieve_full_rows, memory::Root *parent_alloc)
int init ()
int reset (void)
int get_next ()
bool reverse_sorted () const
bool unique_key_range () const
int get_type () const
void add_keys_and_lengths (std::string *key_names, std::string *used_lengths)
void add_info_string (std::string *str)
bool is_keys_used (const boost::dynamic_bitset<> &fields)
int init_ror_merged_scan (bool reuse_handler)
bool push_quick_back (QuickRangeSelect *quick_sel_range)
virtual void range_end ()
virtual void save_last_pos ()

Public Attributes

std::vector< QuickRangeSelect * > quick_selects
QuickRangeSelectcpk_quick
memory::Root alloc
Sessionsession
bool need_to_fetch_row
bool scans_inited
bool sorted
ha_rows records
double read_time
Tablehead
uint32_t index
uint32_t max_used_key_length
uint32_t used_key_parts
unsigned char * last_rowid
unsigned char * record

Detailed Description

Rowid-Ordered Retrieval (ROR) index intersection quick select. This quick select produces intersection of row sequences returned by several QuickRangeSelects it "merges".

All merged QuickRangeSelects must return rowids in rowid order. QuickRorIntersectSelect will return rows in rowid order, too.

All merged quick selects retrieve {rowid, covered_fields} tuples (not full table records). QuickRorIntersectSelect retrieves full records if it is not being used by QuickRorIntersectSelect and all merged quick selects together don't cover needed all fields.

If one of the merged quick selects is a Clustered PK range scan, it is used only to filter rowid sequence produced by other merged quick selects.

Definition at line 50 of file quick_ror_intersect_select.h.


Member Function Documentation

Append text representation of quick select structure (what and how is merged) to str. The result is added to "Extra" field in EXPLAIN output.

Note:

This function is implemented only by quick selects that merge other quick selects output and/or can produce output suitable for merging.

Reimplemented from drizzled::optimizer::QuickSelectInterface.

Definition at line 251 of file quick_ror_intersect_select.cc.

void drizzled::optimizer::QuickRorIntersectSelect::add_keys_and_lengths ( std::string *  key_names,
std::string *  used_lengths 
) [virtual]

Append comma-separated list of keys this quick select uses to key_names; append comma-separated list of corresponding used lengths to used_lengths.

Note:
This is used by during explain plan.

Implements drizzled::optimizer::QuickSelectInterface.

Definition at line 276 of file quick_ror_intersect_select.cc.

Retrieve next record. SYNOPSIS QuickRorIntersectSelect::get_next()

NOTES Invariant on enter/exit: all intersected selects have retrieved all index records with rowid <= some_rowid_val and no intersected select has retrieved any index records with rowid > some_rowid_val. We start fresh and loop until we have retrieved the same rowid in each of the key scans or we got an error.

If a Clustered PK scan is present, it is used only to check if row satisfies its condition (and never used for row retrieval).

RETURN

Return values:
0- Ok
other- Error code if any error occurred.
Todo:
: fix this madness!!!!

Implements drizzled::optimizer::QuickSelectInterface.

Definition at line 172 of file quick_ror_intersect_select.cc.

References drizzled::optimizer::QuickRangeSelect::get_next(), and drizzled::optimizer::QuickSelectInterface::record.

Returns the type of this quick select - one of the QS_TYPE_* values

Implements drizzled::optimizer::QuickSelectInterface.

Definition at line 113 of file quick_ror_intersect_select.h.

Do post-constructor initialization. SYNOPSIS QuickRorIntersectSelect::init()

RETURN

Return values:
0OK
otherError code

Implements drizzled::optimizer::QuickSelectInterface.

Definition at line 87 of file quick_ror_intersect_select.cc.

Initialize this quick select to be a part of a ROR-merged scan. SYNOPSIS QuickRorIntersectSelect::init_ror_merged_scan() reuse_handler If true, use head->cursor, otherwise create separate Cursor object. RETURN

Return values:
0OK
othererror code

Reimplemented from drizzled::optimizer::QuickSelectInterface.

Definition at line 94 of file quick_ror_intersect_select.cc.

References drizzled::optimizer::QuickRangeSelect::init_ror_merged_scan().

bool drizzled::optimizer::QuickRorIntersectSelect::is_keys_used ( const boost::dynamic_bitset<> &  fields) [virtual]

Returns true if any index used by this quick select uses field which is marked in passed bitmap.

Reimplemented from drizzled::optimizer::QuickSelectInterface.

Definition at line 157 of file quick_ror_intersect_select.cc.

Add a merged quick select to this ROR-intersection quick select.

SYNOPSIS QuickRorIntersectSelect::push_quick_back() quick Quick select to be added. The quick select must return rows in rowid order. NOTES This call can only be made before init() is called.

RETURN

Return values:
falseOK
trueOut of memory.

Definition at line 150 of file quick_ror_intersect_select.cc.

virtual void drizzled::optimizer::QuickSelectInterface::range_end ( ) [inline, virtual, inherited]

Range end should be called when we have looped over the whole index

Reimplemented in drizzled::optimizer::QuickRangeSelect.

Definition at line 190 of file range.h.

Initialize quick select for row retrieval. SYNOPSIS reset() RETURN

Return values:
0OK
otherError code

Implements drizzled::optimizer::QuickSelectInterface.

Definition at line 132 of file quick_ror_intersect_select.cc.

virtual void drizzled::optimizer::QuickSelectInterface::save_last_pos ( ) [inline, virtual, inherited]

Save ROWID of last retrieved row in file->ref. This used in ROR-merging.

Reimplemented in drizzled::optimizer::QuickRangeSelect.

Definition at line 235 of file range.h.

Referenced by drizzled::optimizer::QuickRorUnionSelect::get_next().


Member Data Documentation

Memory pool for this and merged quick selects data.

Definition at line 162 of file quick_ror_intersect_select.h.

Merged quick select that uses Clustered PK, if there is one. This quick select is not used for row retrieval, it is used for row retrieval.

Definition at line 160 of file quick_ror_intersect_select.h.

Index this quick select uses, or MAX_KEY for quick selects that use several indexes

Definition at line 120 of file range.h.

Referenced by drizzled::best_access_path(), drizzled::optimizer::Scan::getStats(), drizzled::test_if_skip_sort_order(), and drizzled::update_query().

The rowid of last row retrieved by this quick select. This is used only when doing ROR-index_merge selects

Definition at line 138 of file range.h.

Referenced by drizzled::optimizer::QuickRorUnionSelect::get_next().

Total length of first used_key_parts parts of the key. Applicable if index!= MAX_KEY.

Definition at line 125 of file range.h.

if true, do retrieve full table records.

Definition at line 164 of file quick_ror_intersect_select.h.

Range quick selects this intersection consists of, not including cpk_quick.

Definition at line 154 of file quick_ror_intersect_select.h.

time to perform this retrieval

Definition at line 114 of file range.h.

Referenced by drizzled::best_access_path(), and drizzled::make_join_statistics().

estimate of # of records to be retrieved

Definition at line 113 of file range.h.

Referenced by drizzled::FileSort::run().

in top-level quick select, true if merged scans where initialized

Definition at line 166 of file quick_ror_intersect_select.h.

Pointer to the current session

Definition at line 163 of file quick_ror_intersect_select.h.

Maximum number of (first) key parts this quick select uses for retrieval. eg. for "(key1p1=c1 AND key1p2=c2) OR key1p1=c2" used_key_parts == 2. Applicable if index!= MAX_KEY.

For QUICK_GROUP_MIN_MAX_SELECT it includes MIN/MAX argument keyparts.

Definition at line 133 of file range.h.

Referenced by drizzled::test_if_skip_sort_order().


The documentation for this class was generated from the following files: