MySQL 8.0.31
Source Code Documentation
interesting_orders_defs.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2022, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef SQL_JOIN_OPTIMIZER_INTERESTING_ORDERS_DEFS_H
24#define SQL_JOIN_OPTIMIZER_INTERESTING_ORDERS_DEFS_H
25
26// Definitions related to interesting_orders.h that can be pulled in
27// without additional dependencies on MySQL headers.
28
29#include <bitset>
30
31enum enum_order : int;
32class Item;
33class THD;
34
35// All Item * are normalized to opaque handles, where handle(x) == handle(y)
36// iff x->eq(y, /*binary_cmp=*/true). This makes them faster to compare,
37// and as an added bonus, they also take up slightly less memory.
38using ItemHandle = int;
39
40// Like ORDER, but smaller and easier to handle for our purposes (in particular,
41// no double-pointer for item). Designed for planning, not execution, so you
42// will need to make a Filesort element out of it eventually.
45
46 // ORDER_NOT_RELEVANT for a group specification. Groupings are by convention
47 // sorted by item.
49};
50
51inline bool operator==(const OrderElement &a, const OrderElement &b) {
52 return a.item == b.item && a.direction == b.direction;
53}
54
55// We represent sets of functional dependencies by bitsets, and for simplicity,
56// we only allow a fixed number of them; if you have more of them, they will not
57// get their own bitmask and will be silently ignored (imposisble to follow in
58// the state machine). Note that this does not include “always-on” FDs and FDs
59// that will be pruned away, as these are either removed or silently removed to
60// the highest indexes.
61static constexpr int kMaxSupportedFDs = 64;
62using FunctionalDependencySet = std::bitset<kMaxSupportedFDs>;
63
64static constexpr int kMaxSupportedOrderings = 64;
65using OrderingSet = std::bitset<kMaxSupportedOrderings>;
66
67#endif // SQL_JOIN_OPTIMIZER_INTERESTING_ORDERS_H
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:922
std::bitset< kMaxSupportedFDs > FunctionalDependencySet
Definition: interesting_orders_defs.h:62
static constexpr int kMaxSupportedFDs
Definition: interesting_orders_defs.h:61
std::bitset< kMaxSupportedOrderings > OrderingSet
Definition: interesting_orders_defs.h:65
bool operator==(const OrderElement &a, const OrderElement &b)
Definition: interesting_orders_defs.h:51
static constexpr int kMaxSupportedOrderings
Definition: interesting_orders_defs.h:64
int ItemHandle
Definition: interesting_orders_defs.h:38
enum_order
Definition: key_spec.h:64
Definition: interesting_orders_defs.h:43
enum_order direction
Definition: interesting_orders_defs.h:48
ItemHandle item
Definition: interesting_orders_defs.h:44