MySQL 8.0.39
Source Code Documentation
group_index_skip_scan_plan.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SQL_RANGE_OPTIMIZER_GROUP_INDEX_SKIP_SCAN_PLAN_H_
25#define SQL_RANGE_OPTIMIZER_GROUP_INDEX_SKIP_SCAN_PLAN_H_
26
27#include <sys/types.h>
28
29#include "my_base.h"
30#include "my_inttypes.h"
32#include "sql/sql_const.h"
33
34class KEY;
35class KEY_PART_INFO;
37class RANGE_OPT_PARAM;
38class SEL_ROOT;
39class SEL_TREE;
40
41/*
42 Plan for a GroupIndexSkipScanIterator scan.
43*/
44
48 /**
49 true if there is an aggregate distinct function, e.g.
50 "COUNT(DISTINCT x)"
51 */
53 /**
54 The key_part of the only field used by all MIN/MAX functions.
55 Note that GROUP_INDEX_SKIP_SCAN is not used if there are MIN/MAX
56 functions on more than one field.
57 */
59 uint group_prefix_len; ///< Length of all key parts in the group prefix
60 uint group_key_parts; ///< Number of index key parts in the group prefix
61 KEY *index_info; ///< The index chosen for data access
62 uint key_infix_len; ///< Longest key for equality predicates
64 *index_tree_tracing_only; ///< The sub-tree corresponding to index_info
65 bool is_index_scan; ///< Use index_next() instead of random read
72};
73
75 SEL_TREE *tree, enum_order order_direction,
76 bool skip_records_in_range, double cost_est);
77
79 const RANGE_OPT_PARAM *,
80 Opt_trace_object *trace_object);
81
82void dbug_dump_group_index_skip_scan(int indent, bool verbose,
83 const AccessPath *path);
84
85#endif // SQL_RANGE_OPTIMIZER_GROUP_INDEX_SKIP_SCAN_PLAN_H_
Definition: key.h:57
Definition: key.h:113
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
A JSON object (unordered set of key/value pairs).
Definition: opt_trace.h:799
Definition: range_opt_param.h:29
A graph of (possible multiple) key ranges, represented as a red-black binary tree.
Definition: tree.h:68
Definition: tree.h:871
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
AccessPath * get_best_group_min_max(THD *thd, RANGE_OPT_PARAM *param, SEL_TREE *tree, enum_order order_direction, bool skip_records_in_range, double cost_est)
Test if this access method is applicable to a GROUP query with MIN/MAX functions, and if so,...
Definition: group_index_skip_scan_plan.cc:286
void trace_basic_info_group_index_skip_scan(THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *, Opt_trace_object *trace_object)
Definition: group_index_skip_scan_plan.cc:78
void dbug_dump_group_index_skip_scan(int indent, bool verbose, const AccessPath *path)
Definition: group_index_skip_scan_plan.cc:1685
enum_order
Definition: key_spec.h:65
This file includes constants used by all storage engines.
Some integer typedefs for easier portability.
static uint verbose
Definition: mysqlcheck.cc:65
static char * path
Definition: mysqldump.cc:137
File containing constants that can be used throughout the server.
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:193
Definition: group_index_skip_scan_plan.h:45
Quick_ranges_array key_infix_ranges
Definition: group_index_skip_scan_plan.h:70
uint group_key_parts
Number of index key parts in the group prefix.
Definition: group_index_skip_scan_plan.h:60
Mem_root_array< Item_sum * > max_functions
Definition: group_index_skip_scan_plan.h:47
uint real_key_parts
Definition: group_index_skip_scan_plan.h:67
Mem_root_array< Item_sum * > min_functions
Definition: group_index_skip_scan_plan.h:46
uint group_prefix_len
Length of all key parts in the group prefix.
Definition: group_index_skip_scan_plan.h:59
bool have_agg_distinct
true if there is an aggregate distinct function, e.g.
Definition: group_index_skip_scan_plan.h:52
uint max_used_key_length
Definition: group_index_skip_scan_plan.h:68
uint key_infix_len
Longest key for equality predicates.
Definition: group_index_skip_scan_plan.h:62
Quick_ranges prefix_ranges
Definition: group_index_skip_scan_plan.h:69
KEY_PART * used_key_part
Definition: group_index_skip_scan_plan.h:66
bool is_index_scan
Use index_next() instead of random read.
Definition: group_index_skip_scan_plan.h:65
Quick_ranges min_max_ranges
Definition: group_index_skip_scan_plan.h:71
KEY_PART_INFO * min_max_arg_part
The key_part of the only field used by all MIN/MAX functions.
Definition: group_index_skip_scan_plan.h:58
SEL_ROOT * index_tree_tracing_only
The sub-tree corresponding to index_info.
Definition: group_index_skip_scan_plan.h:64
KEY * index_info
The index chosen for data access.
Definition: group_index_skip_scan_plan.h:61
Definition: range_optimizer.h:55
unsigned int uint
Definition: uca9-dump.cc:75