MySQL 8.3.0
Source Code Documentation
row0sel.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1997, 2023, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/row0sel.h
28 Select
29
30 Created 12/19/1997 Heikki Tuuri
31 *******************************************************/
32
33#ifndef row0sel_h
34#define row0sel_h
35
36#include "univ.i"
37
38#include "btr0pcur.h"
39#include "data0data.h"
40#include "dict0stats.h"
41#include "dict0types.h"
42#include "pars0sym.h"
43#include "que0types.h"
44#include "read0types.h"
45#include "row0mysql.h"
46#include "row0types.h"
47#include "trx0types.h"
48
49/** Creates a select node struct.
50 @return own: select node struct */
52 mem_heap_t *heap); /*!< in: memory heap where created */
53/** Frees the memory private to a select node when a query graph is freed,
54 does not free the heap where the node was originally created. */
55void sel_node_free_private(sel_node_t *node); /*!< in: select node struct */
56/** Frees a prefetch buffer for a column, including the dynamically allocated
57 memory for data stored there. */
59 sel_buf_t *prefetch_buf); /*!< in, own: prefetch buffer */
60
61/** Gets the plan node for the nth table in a join.
62@param[in] node select node
63@param[in] i get ith plan node
64@return plan node */
66
67/** Performs a select step. This is a high-level function used in SQL execution
68 graphs.
69 @return query thread to run next or NULL */
70que_thr_t *row_sel_step(que_thr_t *thr); /*!< in: query thread */
71/** Performs an execution step of an open or close cursor statement node.
72 @return query thread to run next or NULL */
73static inline que_thr_t *open_step(que_thr_t *thr); /*!< in: query thread */
74/** Performs a fetch for a cursor.
75 @return query thread to run next or NULL */
76que_thr_t *fetch_step(que_thr_t *thr); /*!< in: query thread */
77
78/** Copy used fields from cached row.
79Copy cache record field by field, don't touch fields that
80are not covered by current key.
81@param[out] buf Where to copy the MySQL row.
82@param[in] cached_rec What to copy (in MySQL row format).
83@param[in] prebuilt prebuilt struct. */
84void row_sel_copy_cached_fields_for_mysql(byte *buf, const byte *cached_rec,
85 row_prebuilt_t *prebuilt);
86
87// clang-format off
88/** Convert a row in the Innobase format to a row in the MySQL format.
89Note that the template in prebuilt may advise us to copy only a few
90columns to mysql_rec, other columns are left blank. All columns may not
91be needed in the query.
92@param[out] mysql_rec row in the MySQL format
93@param[in,out] prebuilt prebuilt structure
94@param[in] rec Innobase record in the index
95 which was described in prebuilt's
96 template, or in the clustered index;
97 must be protected by a page latch
98@param[in] vrow virtual columns
99@param[in] rec_clust true if rec is in the clustered index
100 instead of index which could belong to
101 prebuilt->index
102@param[in] rec_index index of rec
103@param[in] prebuilt_index prebuilt->index
104@param[in] offsets array returned by rec_get_offsets(rec)
105@param[in] clust_templ_for_sec true if rec belongs to secondary index
106 but the prebuilt->template is in
107 clustered index format and it
108 is used only for end range comparison
109@param[in] lob_undo the LOB undo information.
110@param[in,out] blob_heap If not null then use this heap for BLOBs
111@return true on success, false if not all columns could be retrieved */
112// clang-format on
113bool row_sel_store_mysql_rec(byte *mysql_rec, row_prebuilt_t *prebuilt,
114 const rec_t *rec, const dtuple_t *vrow,
115 bool rec_clust, const dict_index_t *rec_index,
116 const dict_index_t *prebuilt_index,
117 const ulint *offsets, bool clust_templ_for_sec,
118 lob::undo_vers_t *lob_undo,
119 mem_heap_t *&blob_heap);
120
121/** Converts a key value stored in MySQL format to an Innobase dtuple. The last
122field of the key value may be just a prefix of a fixed length field: hence
123the parameter key_len. But currently we do not allow search keys where the
124last field is only a prefix of the full key field len and print a warning if
125such appears.
126@param[in,out] tuple Tuple where to build; NOTE: we assume that the type info in
127the tuple is already according to index!
128@param[in] buf Buffer to use in field conversions; NOTE that dtuple->data may
129end up pointing inside buf so do not discard that buffer while the tuple is
130being used. See row_mysql_store_col_in_innobase_format() in the case of
131DATA_INT.
132@param[in] buf_len Buffer length.
133@param[in] index Index of the key value.
134@param[in] key_ptr MySQL key value
135@param[in] key_len MySQL key value length
136*/
138 ulint buf_len, dict_index_t *index,
139 const byte *key_ptr, ulint key_len);
140
141/** Searches for rows in the database. This is used in the interface to
142MySQL. This function opens a cursor, and also implements fetch next
143and fetch prev. NOTE that if we do a search with a full key value
144from a unique index (ROW_SEL_EXACT), then we will not store the cursor
145position and fetch next or fetch prev must not be tried to the cursor!
146
147@param[out] buf buffer for the fetched row in MySQL format
148@param[in] mode search mode PAGE_CUR_L
149@param[in,out] prebuilt prebuilt struct for the table handler;
150 this contains the info to search_tuple,
151 index; if search tuple contains 0 field then
152 we position the cursor at start or the end of
153 index, depending on 'mode'
154@param[in] match_mode 0 or ROW_SEL_EXACT or ROW_SEL_EXACT_PREFIX
155@param[in] direction 0 or ROW_SEL_NEXT or ROW_SEL_PREV;
156 Note: if this is != 0, then prebuilt must has a
157 pcur with stored position! In opening of a
158 cursor 'direction' should be 0.
159@return DB_SUCCESS, DB_RECORD_NOT_FOUND, DB_END_OF_INDEX, DB_DEADLOCK,
160DB_LOCK_TABLE_FULL, DB_CORRUPTION, or DB_TOO_BIG_RECORD */
161[[nodiscard]] static inline dberr_t row_search_for_mysql(
162 byte *buf, page_cur_mode_t mode, row_prebuilt_t *prebuilt, ulint match_mode,
163 ulint direction);
164
165/** Searches for rows in the database using cursor.
166Function is for temporary tables that are not shared across connections
167and so lot of complexity is reduced especially locking and transaction related.
168The cursor is an iterator over the table/index.
169
170@param[out] buf buffer for the fetched row in MySQL format
171@param[in] mode search mode PAGE_CUR_L
172@param[in,out] prebuilt prebuilt struct for the table handler;
173 this contains the info to search_tuple,
174 index; if search tuple contains 0 field then
175 we position the cursor at start or the end of
176 index, depending on 'mode'
177@param[in] match_mode 0 or ROW_SEL_EXACT or ROW_SEL_EXACT_PREFIX
178@param[in] direction 0 or ROW_SEL_NEXT or ROW_SEL_PREV;
179 Note: if this is != 0, then prebuilt must has a
180 pcur with stored position! In opening of a
181 cursor 'direction' should be 0.
182@return DB_SUCCESS or error code */
184 row_prebuilt_t *prebuilt,
185 ulint match_mode, ulint direction);
186
187/** Searches for rows in the database using cursor.
188Function is mainly used for tables that are shared accorss connection and
189so it employs technique that can help re-construct the rows that
190transaction is suppose to see.
191It also has optimization such as pre-caching the rows, using AHI, etc.
192
193@param[out] buf buffer for the fetched row in MySQL format
194@param[in] mode search mode PAGE_CUR_L
195@param[in,out] prebuilt prebuilt struct for the table handler;
196 this contains the info to search_tuple,
197 index; if search tuple contains 0 field then
198 we position the cursor at start or the end of
199 index, depending on 'mode'
200@param[in] match_mode 0 or ROW_SEL_EXACT or ROW_SEL_EXACT_PREFIX
201@param[in] direction 0 or ROW_SEL_NEXT or ROW_SEL_PREV;
202 Note: if this is != 0, then prebuilt must has a
203 pcur with stored position! In opening of a
204 cursor 'direction' should be 0.
205@return DB_SUCCESS or error code */
206[[nodiscard]] dberr_t row_search_mvcc(byte *buf, page_cur_mode_t mode,
207 row_prebuilt_t *prebuilt,
208 ulint match_mode, const ulint direction);
209
210/** Count rows in a R-Tree leaf level.
211 @return DB_SUCCESS if successful */
213 row_prebuilt_t *prebuilt, /*!< in: prebuilt struct for the
214 table handle; this contains the info
215 of search_tuple, index; if search
216 tuple contains 0 fields then we
217 position the cursor at the start or
218 the end of the index, depending on
219 'mode' */
220 ulint *n_rows, /*!< out: number of entries
221 seen in the consistent read */
222 ulint *n_dups); /*!< out: number of dup entries
223 seen in the consistent read */
224
225/** Read the max AUTOINC value from an index.
226 @return DB_SUCCESS if all OK else error code */
227[[nodiscard]] dberr_t row_search_max_autoinc(
228 dict_index_t *index, /*!< in: index to search */
229 const char *col_name, /*!< in: autoinc column name */
230 uint64_t *value); /*!< out: AUTOINC value read */
231
232/** A structure for caching column values for prefetched rows */
233struct sel_buf_t {
234 byte *data; /*!< data, or NULL; if not NULL, this field
235 has allocated memory which must be explicitly
236 freed; can be != NULL even when len is
237 UNIV_SQL_NULL */
238 ulint len; /*!< data length or UNIV_SQL_NULL */
240 /*!< size of memory buffer allocated for data:
241 this can be more than len; this is defined
242 when data != NULL */
243};
244
245/** Query plan */
246struct plan_t {
247 dict_table_t *table; /*!< table struct in the dictionary
248 cache */
249 dict_index_t *index; /*!< table index used in the search */
250 btr_pcur_t pcur; /*!< persistent cursor used to search
251 the index */
252 bool asc; /*!< true if cursor traveling upwards */
253 bool pcur_is_open; /*!< true if pcur has been positioned
254 and we can try to fetch new rows */
255 bool cursor_at_end; /*!< true if the cursor is open but
256 we know that there are no more
257 qualifying rows left to retrieve from
258 the index tree; NOTE though, that
259 there may still be unprocessed rows in
260 the prefetch stack; always false when
261 pcur_is_open is false */
263 /*!< true if the pcur position has been
264 stored and the record it is positioned
265 on has already been processed */
266 que_node_t **tuple_exps; /*!< array of expressions
267 which are used to calculate
268 the field values in the search
269 tuple: there is one expression
270 for each field in the search
271 tuple */
272 dtuple_t *tuple; /*!< search tuple */
273 page_cur_mode_t mode; /*!< search mode: PAGE_CUR_G, ... */
274 ulint n_exact_match; /*!< number of first fields in
275 the search tuple which must be
276 exactly matched */
277 bool unique_search; /*!< true if we are searching an
278 index record with a unique key */
279 ulint n_rows_fetched; /*!< number of rows fetched using pcur
280 after it was opened */
281 ulint n_rows_prefetched; /*!< number of prefetched rows cached
282 for fetch: fetching several rows in
283 the same mtr saves CPU time */
284 ulint first_prefetched; /*!< index of the first cached row in
285 select buffer arrays for each column */
286 bool no_prefetch; /*!< no prefetch for this table */
287 sym_node_list_t columns; /*!< symbol table nodes for the columns
288 to retrieve from the table */
290 /** conditions which determine the fetch limit of the index segment we have to
291 look at: when one of these fails, the result set has been exhausted for the
292 cursor in this index; these conditions are normalized so that in a comparison
293 the column for this table is the first argument */
295 /** the rest of search conditions we can test at this table in a join */
297 bool must_get_clust; /*!< true if index is a non-clustered
298 index and we must also fetch the
299 clustered index record; this is the
300 case if the non-clustered record does
301 not contain all the needed columns, or
302 if this is a single-table explicit
303 cursor, or a searched update or
304 delete */
305 ulint *clust_map; /*!< map telling how clust_ref is built
306 from the fields of a non-clustered
307 record */
308 dtuple_t *clust_ref; /*!< the reference to the clustered
309 index entry is built here if index is
310 a non-clustered index */
311 btr_pcur_t clust_pcur; /*!< if index is non-clustered, we use
312 this pcur to search the clustered
313 index */
314 mem_heap_t *old_vers_heap; /*!< memory heap used in building an old
315 version of a row, or NULL */
316};
317
318/** Select node states */
320 SEL_NODE_CLOSED, /*!< it is a declared cursor which is not
321 currently open */
322 SEL_NODE_OPEN, /*!< intention locks not yet set on tables */
323 SEL_NODE_FETCH, /*!< intention locks have been set */
324 SEL_NODE_NO_MORE_ROWS /*!< cursor has reached the result set end */
326
327/** Select statement node */
329 que_common_t common; /*!< node type: QUE_NODE_SELECT */
330 enum sel_node_state state; /*!< node state */
331 que_node_t *select_list; /*!< select list */
332 sym_node_t *into_list; /*!< variables list or NULL */
333 sym_node_t *table_list; /*!< table list */
334 bool asc; /*!< true if the rows should be fetched
335 in an ascending order */
336 bool set_x_locks; /*!< true if the cursor is for update or
337 delete, which means that a row x-lock
338 should be placed on the cursor row */
339 ulint row_lock_mode; /*!< LOCK_X or LOCK_S */
340 ulint n_tables; /*!< number of tables */
341 ulint fetch_table; /*!< number of the next table to access
342 in the join */
343 plan_t *plans; /*!< array of n_tables many plan nodes
344 containing the search plan and the
345 search data structures */
346 que_node_t *search_cond; /*!< search condition */
347 ReadView *read_view; /*!< if the query is a non-locking
348 consistent read, its read view is
349 placed here, otherwise NULL */
350 bool consistent_read; /*!< true if the select is a consistent,
351 non-locking read */
352 order_node_t *order_by; /*!< order by column definition, or
353 NULL */
354 bool is_aggregate; /*!< true if the select list consists of
355 aggregate functions */
357 /*!< true if the aggregate row has
358 already been fetched for the current
359 cursor */
360
361 /** this is true if the select is in a single-table explicit cursor which can
362 get updated within the stored procedure, or in a searched update or delete;
363 NOTE that to determine of an explicit cursor if it can get updated, the
364 parser checks from a stored procedure if it contains positioned update or
365 delete statements */
367 /** not NULL if an explicit cursor */
369 /** variables whose values we have to copy when an explicit cursor is opened,
370 so that they do not change between fetches */
371 sym_node_list_t copy_variables;
372};
373
374/** Fetch statement node */
376 que_common_t common; /*!< type: QUE_NODE_FETCH */
377 sel_node_t *cursor_def; /*!< cursor definition */
378 sym_node_t *into_list; /*!< variables to set */
379
380 pars_user_func_t *func; /*!< User callback function or NULL.
381 The first argument to the function
382 is a sel_node_t*, containing the
383 results of the SELECT operation for
384 one row. If the function returns
385 NULL, it is not interested in
386 further rows and the cursor is
387 modified so (cursor % NOTFOUND) is
388 true. If it returns not-NULL,
389 continue normally. */
390};
391
392/** Open or close cursor operation type */
394 ROW_SEL_OPEN_CURSOR, /*!< open cursor */
395 ROW_SEL_CLOSE_CURSOR /*!< close cursor */
397
398/** Open or close cursor statement node */
400 que_common_t common; /*!< type: QUE_NODE_OPEN */
401 enum open_node_op op_type; /*!< operation type: open or
402 close cursor */
403 sel_node_t *cursor_def; /*!< cursor definition */
404};
405
406/** Search direction for the MySQL interface */
408 ROW_SEL_NEXT = 1, /*!< ascending direction */
409 ROW_SEL_PREV = 2 /*!< descending direction */
411
412/** Match mode for the MySQL interface */
414 ROW_SEL_EXACT = 1, /*!< search using a complete key value */
415 ROW_SEL_EXACT_PREFIX /*!< search using a key prefix which
416 must match rows: the prefix may
417 contain an incomplete field (the last
418 field in prefix may be just a prefix
419 of a fixed length column) */
421
422/** Stores a non-SQL-NULL field in the MySQL format. The counterpart of this
423function is row_mysql_store_col_in_innobase_format() in row0mysql.cc.
424@param[in,out] dest buffer where to store; NOTE
425 that BLOBs are not in themselves stored
426 here: the caller must allocate and copy
427 the BLOB into buffer before, and pass
428 the pointer to the BLOB in 'data'
429@param[in] templ MySQL column template. Its following fields
430 are referenced: type, is_unsigned,
431mysql_col_len, mbminlen, mbmaxlen
432@param[in] index InnoDB index
433@param[in] field_no templ->rec_field_no or templ->clust_rec_field_no
434 or templ->icp_rec_field_no
435@param[in] data data to store
436@param[in] len length of the data
437@param[in] sec_field secondary index field no if the secondary index
438 record but the prebuilt template is in
439 clustered index format and used only for end
440 range comparison. */
442 byte *dest, const mysql_row_templ_t *templ, const dict_index_t *index,
443 IF_DEBUG(ulint field_no, ) const byte *data,
444 ulint len IF_DEBUG(, ulint sec_field));
445
446/** Convert a non-SQL-NULL field from Innobase format to MySQL format. */
448 byte *dest, const mysql_row_templ_t *templ, const dict_index_t *idx,
449 ulint field, const byte *src, ulint len, ulint sec) {
451 dest, templ, idx, IF_DEBUG(field, ) src, len IF_DEBUG(, sec));
452}
453
454/** Search the record present in innodb_table_stats table using
455db_name, table_name and fill it in table stats structure.
456@param[in] db_name database name
457@param[in] tbl_name table name
458@param[out] table_stats stats table structure.
459@return true if successful else false. */
460bool row_search_table_stats(const char *db_name, const char *tbl_name,
462
463/** Search the record present in innodb_index_stats using
464db_name, table name and index_name and fill the
465cardinality for the each column.
466@param[in] db_name database name
467@param[in] tbl_name table name
468@param[in] index_name index name
469@param[in] col_offset offset of the column in the index
470@param[out] cardinality cardinality of the column.
471@return true if successful else false. */
472bool row_search_index_stats(const char *db_name, const char *tbl_name,
473 const char *index_name, ulint col_offset,
474 ulonglong *cardinality);
475
476#include "row0sel.ic"
477
478#endif
The index tree persistent cursor.
Read view lists the trx ids of those transactions for which a consistent read should not see the modi...
Definition: read0types.h:47
Represent the record of innodb_table_stats table.
Definition: dict0stats.h:162
static struct my_cs_file_section_st sec[]
Definition: ctype.cc:165
SQL data field and tuple.
dberr_t
Definition: db0err.h:38
Code used for calculating and manipulating table statistics.
Data dictionary global types.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Definition: buf0block_hint.cc:29
const String_type table_stats
Definition: global.h:47
const char * db_name
Definition: rules_table_service.cc:54
mode
Definition: file_handle.h:59
page_cur_mode_t
Definition: page0types.h:175
SQL parser symbol table.
Query graph global types.
void que_node_t
Definition: que0types.h:40
Cursor read.
byte rec_t
Definition: rem0types.h:40
Interface between Innobase row operations and MySQL.
void sel_node_free_private(sel_node_t *node)
Frees the memory private to a select node when a query graph is freed, does not free the heap where t...
Definition: row0sel.cc:366
bool row_search_index_stats(const char *db_name, const char *tbl_name, const char *index_name, ulint col_offset, ulonglong *cardinality)
Search the record present in innodb_index_stats using db_name, table name and index_name and fill the...
Definition: row0sel.cc:6366
void row_sel_copy_cached_fields_for_mysql(byte *buf, const byte *cached_rec, row_prebuilt_t *prebuilt)
Copy used fields from cached row.
Definition: row0sel.cc:3513
static que_thr_t * open_step(que_thr_t *thr)
Performs an execution step of an open or close cursor statement node.
static plan_t * sel_node_get_nth_plan(sel_node_t *node, ulint i)
Gets the plan node for the nth table in a join.
row_sel_direction
Search direction for the MySQL interface.
Definition: row0sel.h:407
@ ROW_SEL_PREV
descending direction
Definition: row0sel.h:409
@ ROW_SEL_NEXT
ascending direction
Definition: row0sel.h:408
void sel_col_prefetch_buf_free(sel_buf_t *prefetch_buf)
Frees a prefetch buffer for a column, including the dynamically allocated memory for data stored ther...
Definition: row0sel.cc:555
static void row_sel_field_store_in_mysql_format(byte *dest, const mysql_row_templ_t *templ, const dict_index_t *idx, ulint field, const byte *src, ulint len, ulint sec)
Convert a non-SQL-NULL field from Innobase format to MySQL format.
Definition: row0sel.h:447
sel_node_t * sel_node_create(mem_heap_t *heap)
Creates a select node struct.
Definition: row0sel.cc:349
que_thr_t * row_sel_step(que_thr_t *thr)
Performs a select step.
Definition: row0sel.cc:2109
dberr_t row_search_mvcc(byte *buf, page_cur_mode_t mode, row_prebuilt_t *prebuilt, ulint match_mode, const ulint direction)
Searches for rows in the database using cursor.
Definition: row0sel.cc:4399
void row_sel_field_store_in_mysql_format_func(byte *dest, const mysql_row_templ_t *templ, const dict_index_t *index, ulint field_no, const byte *data, ulint len, ulint sec_field)
Stores a non-SQL-NULL field in the MySQL format.
Definition: row0sel.cc:2500
dberr_t row_search_no_mvcc(byte *buf, page_cur_mode_t mode, row_prebuilt_t *prebuilt, ulint match_mode, ulint direction)
Searches for rows in the database using cursor.
Definition: row0sel.cc:3934
sel_node_state
Select node states.
Definition: row0sel.h:319
@ SEL_NODE_NO_MORE_ROWS
cursor has reached the result set end
Definition: row0sel.h:324
@ SEL_NODE_FETCH
intention locks have been set
Definition: row0sel.h:323
@ SEL_NODE_OPEN
intention locks not yet set on tables
Definition: row0sel.h:322
@ SEL_NODE_CLOSED
it is a declared cursor which is not currently open
Definition: row0sel.h:320
que_thr_t * fetch_step(que_thr_t *thr)
Performs a fetch for a cursor.
Definition: row0sel.cc:2208
void row_sel_convert_mysql_key_to_innobase(dtuple_t *tuple, byte *buf, ulint buf_len, dict_index_t *index, const byte *key_ptr, ulint key_len)
Converts a key value stored in MySQL format to an Innobase dtuple.
Definition: row0sel.cc:2258
static dberr_t row_search_for_mysql(byte *buf, page_cur_mode_t mode, row_prebuilt_t *prebuilt, ulint match_mode, ulint direction)
Searches for rows in the database.
row_sel_match_mode
Match mode for the MySQL interface.
Definition: row0sel.h:413
@ ROW_SEL_EXACT_PREFIX
search using a key prefix which must match rows: the prefix may contain an incomplete field (the last...
Definition: row0sel.h:415
@ ROW_SEL_EXACT
search using a complete key value
Definition: row0sel.h:414
dberr_t row_search_max_autoinc(dict_index_t *index, const char *col_name, uint64_t *value)
Read the max AUTOINC value from an index.
Definition: row0sel.cc:6241
dberr_t row_count_rtree_recs(row_prebuilt_t *prebuilt, ulint *n_rows, ulint *n_dups)
Count rows in a R-Tree leaf level.
Definition: row0sel.cc:6045
open_node_op
Open or close cursor operation type.
Definition: row0sel.h:393
@ ROW_SEL_CLOSE_CURSOR
close cursor
Definition: row0sel.h:395
@ ROW_SEL_OPEN_CURSOR
open cursor
Definition: row0sel.h:394
bool row_search_table_stats(const char *db_name, const char *tbl_name, TableStatsRecord &table_stats)
Search the record present in innodb_table_stats table using db_name, table_name and fill it in table ...
Definition: row0sel.cc:6304
bool row_sel_store_mysql_rec(byte *mysql_rec, row_prebuilt_t *prebuilt, const rec_t *rec, const dtuple_t *vrow, bool rec_clust, const dict_index_t *rec_index, const dict_index_t *prebuilt_index, const ulint *offsets, bool clust_templ_for_sec, lob::undo_vers_t *lob_undo, mem_heap_t *&blob_heap)
Convert a row in the Innobase format to a row in the MySQL format.
Definition: row0sel.cc:2888
Select.
Row operation global types.
Definition: btr0pcur.h:98
Data structure for an index.
Definition: dict0mem.h:1045
Data structure for a database table.
Definition: dict0mem.h:1908
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:681
Fetch statement node.
Definition: row0sel.h:375
sel_node_t * cursor_def
cursor definition
Definition: row0sel.h:377
pars_user_func_t * func
User callback function or NULL.
Definition: row0sel.h:380
sym_node_t * into_list
variables to set
Definition: row0sel.h:378
que_common_t common
type: QUE_NODE_FETCH
Definition: row0sel.h:376
A predefined function or operator node in a parsing tree; this construct is also used for some non-fu...
Definition: pars0pars.h:496
The list of modifications to be applied on LOBs to get older versions.
Definition: lob0undo.h:145
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:301
Definition: row0mysql.h:454
Open or close cursor statement node.
Definition: row0sel.h:399
enum open_node_op op_type
operation type: open or close cursor
Definition: row0sel.h:401
sel_node_t * cursor_def
cursor definition
Definition: row0sel.h:403
que_common_t common
type: QUE_NODE_OPEN
Definition: row0sel.h:400
An order-by node in a select.
Definition: pars0pars.h:515
User-supplied function and argument.
Definition: pars0pars.h:466
Query plan.
Definition: row0sel.h:246
ulint first_prefetched
index of the first cached row in select buffer arrays for each column
Definition: row0sel.h:284
page_cur_mode_t mode
search mode: PAGE_CUR_G, ...
Definition: row0sel.h:273
Cond_list other_conds
the rest of search conditions we can test at this table in a join
Definition: row0sel.h:296
ulint n_rows_prefetched
number of prefetched rows cached for fetch: fetching several rows in the same mtr saves CPU time
Definition: row0sel.h:281
dtuple_t * clust_ref
the reference to the clustered index entry is built here if index is a non-clustered index
Definition: row0sel.h:308
sym_node_list_t columns
symbol table nodes for the columns to retrieve from the table
Definition: row0sel.h:287
bool no_prefetch
no prefetch for this table
Definition: row0sel.h:286
bool unique_search
true if we are searching an index record with a unique key
Definition: row0sel.h:277
dict_table_t * table
table struct in the dictionary cache
Definition: row0sel.h:247
mem_heap_t * old_vers_heap
memory heap used in building an old version of a row, or NULL
Definition: row0sel.h:314
bool must_get_clust
true if index is a non-clustered index and we must also fetch the clustered index record; this is the...
Definition: row0sel.h:297
bool asc
true if cursor traveling upwards
Definition: row0sel.h:252
dtuple_t * tuple
search tuple
Definition: row0sel.h:272
bool pcur_is_open
true if pcur has been positioned and we can try to fetch new rows
Definition: row0sel.h:253
que_node_t ** tuple_exps
array of expressions which are used to calculate the field values in the search tuple: there is one e...
Definition: row0sel.h:266
bool cursor_at_end
true if the cursor is open but we know that there are no more qualifying rows left to retrieve from t...
Definition: row0sel.h:255
btr_pcur_t clust_pcur
if index is non-clustered, we use this pcur to search the clustered index
Definition: row0sel.h:311
dict_index_t * index
table index used in the search
Definition: row0sel.h:249
UT_LIST_BASE_NODE_T_EXTERN(func_node_t, cond_list) Cond_list
Definition: row0sel.h:289
bool stored_cursor_rec_processed
true if the pcur position has been stored and the record it is positioned on has already been process...
Definition: row0sel.h:262
ulint n_exact_match
number of first fields in the search tuple which must be exactly matched
Definition: row0sel.h:274
Cond_list end_conds
conditions which determine the fetch limit of the index segment we have to look at: when one of these...
Definition: row0sel.h:294
ulint n_rows_fetched
number of rows fetched using pcur after it was opened
Definition: row0sel.h:279
btr_pcur_t pcur
persistent cursor used to search the index
Definition: row0sel.h:250
ulint * clust_map
map telling how clust_ref is built from the fields of a non-clustered record
Definition: row0sel.h:305
Definition: que0types.h:50
Definition: que0que.h:241
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:514
A structure for caching column values for prefetched rows.
Definition: row0sel.h:233
byte * data
data, or NULL; if not NULL, this field has allocated memory which must be explicitly freed; can be !...
Definition: row0sel.h:234
ulint len
data length or UNIV_SQL_NULL
Definition: row0sel.h:238
ulint val_buf_size
size of memory buffer allocated for data: this can be more than len; this is defined when data !...
Definition: row0sel.h:239
Select statement node.
Definition: row0sel.h:328
plan_t * plans
array of n_tables many plan nodes containing the search plan and the search data structures
Definition: row0sel.h:343
sym_node_list_t copy_variables
variables whose values we have to copy when an explicit cursor is opened, so that they do not change ...
Definition: row0sel.h:371
sym_node_t * into_list
variables list or NULL
Definition: row0sel.h:332
ulint row_lock_mode
LOCK_X or LOCK_S.
Definition: row0sel.h:339
que_common_t common
node type: QUE_NODE_SELECT
Definition: row0sel.h:329
bool consistent_read
true if the select is a consistent, non-locking read
Definition: row0sel.h:350
bool asc
true if the rows should be fetched in an ascending order
Definition: row0sel.h:334
sym_node_t * explicit_cursor
not NULL if an explicit cursor
Definition: row0sel.h:368
order_node_t * order_by
order by column definition, or NULL
Definition: row0sel.h:352
que_node_t * select_list
select list
Definition: row0sel.h:331
bool can_get_updated
this is true if the select is in a single-table explicit cursor which can get updated within the stor...
Definition: row0sel.h:366
que_node_t * search_cond
search condition
Definition: row0sel.h:346
ReadView * read_view
if the query is a non-locking consistent read, its read view is placed here, otherwise NULL
Definition: row0sel.h:347
ulint n_tables
number of tables
Definition: row0sel.h:340
bool aggregate_already_fetched
true if the aggregate row has already been fetched for the current cursor
Definition: row0sel.h:356
bool set_x_locks
true if the cursor is for update or delete, which means that a row x-lock should be placed on the cur...
Definition: row0sel.h:336
ulint fetch_table
number of the next table to access in the join
Definition: row0sel.h:341
sym_node_t * table_list
table list
Definition: row0sel.h:333
bool is_aggregate
true if the select list consists of aggregate functions
Definition: row0sel.h:354
enum sel_node_state state
node state
Definition: row0sel.h:330
Symbol table node.
Definition: pars0sym.h:112
Transaction system global type definitions.
Version control for database, common definitions, and include files.
#define IF_DEBUG(...)
Definition: univ.i:673
unsigned long int ulint
Definition: univ.i:405
#define UT_LIST_BASE_NODE_T_EXTERN(t, m)
A variant of UT_LIST_BASE_NODE_T to be used in rare cases where the full definition of t is not yet i...
Definition: ut0lst.h:278