CUBRID Engine  latest
scan_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * Scan (Server Side)
22  */
23 
24 #ifndef _SCAN_MANAGER_H_
25 #define _SCAN_MANAGER_H_
26 
27 #ident "$Id$"
28 
29 #if !defined (SERVER_MODE) && !defined (SA_MODE)
30 #error Belongs to server module
31 #endif /* !defined (SERVER_MODE) && !defined (SA_MODE) */
32 
33 #include <time.h>
34 #if defined(SERVER_MODE)
35 #include "jansson.h"
36 #endif
37 
38 #include "btree.h" /* TODO: for BTREE_SCAN */
39 #include "heap_file.h" /* for HEAP_SCANCACHE */
40 #include "method_scan.h" /* for METHOD_SCAN_BUFFER */
41 #include "oid.h" /* for OID */
42 #include "query_evaluator.h"
43 #include "query_list.h"
44 #include "access_json_table.hpp"
45 #include "scan_json_table.hpp"
46 #include "storage_common.h" /* for PAGEID */
47 #include "query_hash_scan.h"
48 
49 // forward definitions
50 struct indx_info;
51 typedef struct indx_info INDX_INFO;
52 struct key_range;
53 struct key_val_range;
54 struct method_sig_list;
55 
57 struct val_descr;
58 typedef struct val_descr VAL_DESCR;
59 struct valptr_list_node;
60 
61 // *INDENT-OFF*
62 namespace cubxasl
63 {
64  struct pred_expr;
65 }
67 // *INDENT-ON*
68 
69 /*
70  * TYPEDEFS RELATED TO THE SCAN DATA STRUCTURES
71  */
72 
73 #define IDX_COV_DEFAULT_TUPLES 200
74 
75 typedef enum
76 {
84  S_VALUES_SCAN, /* regu_values_list scan */
86  S_HEAP_SCAN_RECORD_INFO, /* similar to heap scan but saving record info (and maybe tuple data too). iterates
87  * through all slots even if they do not contain data. */
88  S_HEAP_PAGE_SCAN, /* scans heap pages and queries for page information */
89  S_INDX_KEY_INFO_SCAN, /* scans b-tree and queries for key info */
90  S_INDX_NODE_INFO_SCAN /* scans b-tree nodes for info */
91 } SCAN_TYPE;
92 
93 typedef struct heap_scan_id HEAP_SCAN_ID;
95 {
96  OID curr_oid; /* current object identifier */
97  OID cls_oid; /* class object identifier */
98  HFID hfid; /* heap file identifier */
99  HEAP_SCANCACHE scan_cache; /* heap file scan_cache */
100  HEAP_SCANRANGE scan_range; /* heap file scan range */
101  SCAN_PRED scan_pred; /* scan predicates(filters) */
102  SCAN_ATTRS pred_attrs; /* attr info from predicates */
103  regu_variable_list_node *rest_regu_list; /* regulator variable list */
104  SCAN_ATTRS rest_attrs; /* attr info from other than preds */
105  bool caches_inited; /* are the caches initialized?? */
108  DB_VALUE **cache_recordinfo; /* cache for record information */
109  regu_variable_list_node *recordinfo_regu_list; /* regulator variable list for record info */
110 }; /* Regular Heap File Scan Identifier */
111 
114 {
115  OID cls_oid; /* class object identifier */
116  HFID hfid; /* heap file identifier */
117  VPID curr_vpid; /* current heap page identifier */
118  SCAN_PRED scan_pred; /* scan predicates(filters) */
119  DB_VALUE **cache_page_info; /* values for page headers */
120  regu_variable_list_node *page_info_regu_list; /* regulator variable for page info */
121 }; /* Heap File Scan Identifier used to scan pages only (e.g. headers) */
122 
123 typedef struct indx_cov INDX_COV;
124 struct indx_cov
125 {
126  QFILE_LIST_ID *list_id; /* list file identifier */
128  QFILE_TUPLE_RECORD *tplrec; /* tuple record */
129  QFILE_LIST_SCAN_ID *lsid; /* list file scan identifier */
130  VAL_DESCR *val_descr; /* val descriptor */
131  valptr_list_node *output_val_list; /* output val list */
132  regu_variable_list_node *regu_val_list; /* regulator variable list */
133  QUERY_ID query_id; /* query id */
134  int max_tuples; /* maximum tuples stored in list_id */
135  int func_index_col_id; /* position of the function expression in the index, if it is a function index */
136 };
137 
138 /* multiple range optimization used on range search index scan:
139  * - uses memory instead of lists to store range search results
140  * - drops range search faster when key condition is not fulfilled */
143 {
144  DB_VALUE index_value; /* index value (MIDXKEY) as it is read from B+ tree. */
145  OID inst_oid; /* instance OID corresponding to index key */
146 };
147 
150 {
151  bool use; /* true/false */
152  bool has_null_domain; /* true, if sort col has null domain */
153  int cnt; /* current number of entries */
154  int size; /* expected number of entries */
155  int num_attrs; /* number of order by attributes */
156  bool *is_desc_order; /* sorting in descending order */
157  int *sort_att_idx; /* index of MIDXKEY attribute on which the sort is performed */
158  QFILE_TUPLE_RECORD tplrec; /* tuple record to dump MIDXKEYs into */
159  TP_DOMAIN **sort_col_dom; /* sorting column domain */
160  RANGE_OPT_ITEM **top_n_items; /* array with top n items */
161  RANGE_OPT_ITEM **buffer; /* temporary buffer used to copy elements from top_n_items */
162 };
163 
164 /* Index Skip Scan Operation types: Get the first valid key for the first
165  * column, do a regular range search or search for the next value in the first
166  * column, to use in the next regular range search.
167  */
168 typedef enum
169 {
174 }
176 
179 {
180  bool use;
181  ISS_OP_TYPE current_op; /* one of the ISS_OP_ flags */
182  key_range *skipped_range; /* range used for iterating the distinct values on the first index column */
183 };
184 
185 /* typedef struct indx_scan_id INDX_SCAN_ID; - already defined in btree.h */
187 {
188  INDX_INFO *indx_info; /* index information */
189  BTREE_TYPE bt_type; /* index type */
190  int bt_num_attrs; /* num of attributes of the index key */
191  ATTR_ID *bt_attr_ids; /* attr id array of the index key */
192  int *bt_attrs_prefix_length; /* attr prefix length */
193  ATTR_ID *vstr_ids; /* attr id array of variable string */
194  int num_vstr; /* num of variable string attrs */
195  BTREE_SCAN bt_scan; /* index scan info. structure */
196  bool one_range; /* a single range? */
197  int curr_keyno; /* current key number */
198  int curr_oidno; /* current oid number */
199  OID *curr_oidp; /* current oid pointer */
200  char *copy_buf; /* index key copy_buf pointer info */
201  BTREE_ISCAN_OID_LIST *oid_list; /* list of object OID's */
202  int oids_count; /* Generic value of OID count that should be common for all index scan types. */
203  OID cls_oid; /* class object identifier */
204  int copy_buf_len; /* index key copy_buf length info */
205  HFID hfid; /* heap file identifier */
206  HEAP_SCANCACHE scan_cache; /* heap file scan_cache */
207  SCAN_PRED key_pred; /* key predicates(filters) */
208  SCAN_ATTRS key_attrs; /* attr info from key filter */
209  SCAN_PRED scan_pred; /* scan predicates(filters) */
210  SCAN_ATTRS pred_attrs; /* attr info from predicates */
211  SCAN_PRED range_pred; /* range predicates */
212  SCAN_ATTRS range_attrs; /* attr info from range predicates */
213  regu_variable_list_node *rest_regu_list; /* regulator variable list */
214  SCAN_ATTRS rest_attrs; /* attr info from other than preds */
215  key_val_range *key_vals; /* for eliminating duplicate ranges */
216  int key_cnt; /* number of valid ranges */
217  bool iscan_oid_order; /* index_scan_oid_order flag */
218  bool need_count_only; /* get count only, no OIDs are copied */
219  bool caches_inited; /* are the caches initialized?? */
221  /* TODO: Can we use these instead of BTS pointers to limits? */
222  DB_BIGINT key_limit_lower; /* lower key limit */
223  DB_BIGINT key_limit_upper; /* upper key limit */
224  INDX_COV indx_cov; /* index covering information */
225  MULTI_RANGE_OPT multi_range_opt; /* optimization for multiple range search */
226  INDEX_SKIP_SCAN iss; /* index skip scan structure */
227  DB_VALUE **key_info_values; /* Used for index key info scan */
228  regu_variable_list_node *key_info_regu_list; /* regulator variable list */
229  bool check_not_vacuumed; /* if true then during index scan, the entries will be checked if they should've been
230  * vacuumed. Used in checkdb. */
231  DISK_ISVALID not_vacuumed_res; /* The result of not vacuumed checking operation */
232  DB_VALUE *fetched_values; /* used for scan_dbvals_to_midxkey() */
233 };
234 
237 {
238  INDX_INFO *indx_info; /* index information */
239  SCAN_PRED scan_pred; /* scan predicates */
241  bool caches_inited; /* are the caches initialized?? */
242  DB_VALUE **node_info_values; /* Used to store information about b-tree node */
243  regu_variable_list_node *node_info_regu_list; /* regulator variable list */
244 };
245 
248 {
249  QFILE_LIST_ID *list_id; /* Points to XASL tree */
250  QFILE_LIST_SCAN_ID lsid; /* List File Scan Identifier */
251  SCAN_PRED scan_pred; /* scan predicates(filters) */
252  regu_variable_list_node *rest_regu_list; /* regulator variable list */
253  QFILE_TUPLE_RECORD *tplrecp; /* tuple record pointer; output param */
254  HASH_LIST_SCAN hlsid; /* for hash scan */
255 };
256 
259 {
260  SHOWSTMT_TYPE show_type; /* show statement type */
261  DB_VALUE **arg_values; /* input argument array */
262  int arg_cnt; /* size of input argment array */
263  DB_VALUE **out_values; /* out values array */
264  int out_cnt; /* size of out value array */
265  int cursor; /* current scan position, start with zero */
266  void *ctx; /* context for different show stmt */
267  SCAN_PRED scan_pred; /* scan predicates(filters) */
268 };
269 
272 {
273  regu_variable_list_node *regu_list; /* the head of list */
275 };
276 
277 typedef struct set_scan_id SET_SCAN_ID;
279 {
280  regu_variable_node *set_ptr; /* Points to XASL tree */
281  regu_variable_list_node *operand; /* operand points current element */
282  DB_VALUE set; /* set we will scan */
283  int set_card; /* cardinality of the set */
284  int cur_index; /* current element index */
285  SCAN_PRED scan_pred; /* scan predicates(filters) */
286 };
287 
288 typedef struct va_scan_id VA_SCAN_ID;
290 {
291  METHOD_SCAN_BUFFER scan_buf; /* value array buffer */
292 };
293 
294 /* Note: Scan position is currently supported only for list file scans. */
295 typedef struct scan_pos SCAN_POS;
296 struct scan_pos
297 {
298  SCAN_STATUS status; /* Scan status */
299  SCAN_POSITION position; /* Scan position */
300  QFILE_TUPLE_POSITION ls_tplpos; /* List file index scan position */
301 }; /* Scan position structure */
302 
303 typedef struct scan_stats SCAN_STATS;
305 {
306  struct timeval elapsed_scan;
307  UINT64 num_fetches;
308  UINT64 num_ioreads;
309 
310  /* for heap & list scan */
311  int read_rows; /* # of rows read */
312  int qualified_rows; /* # of rows qualified by data filter */
313 
314  /* for btree scan */
315  int read_keys; /* # of keys read */
316  int qualified_keys; /* # of keys qualified by key filter */
317  int key_qualified_rows; /* # of rows qualified by key filter */
318  int data_qualified_rows; /* # of rows qualified by data filter */
319  struct timeval elapsed_lookup;
324 
325  /* hash list scan */
326  struct timeval elapsed_hash_build;
327 };
328 
329 typedef struct scan_id_struct SCAN_ID;
331 {
332  SCAN_TYPE type; /* Scan Type */
333  SCAN_STATUS status; /* Scan Status */
334  SCAN_POSITION position; /* Scan Position */
335  SCAN_DIRECTION direction; /* Forward/Backward Direction */
336  bool mvcc_select_lock_needed; /* true if lock at scanning needed in mvcc */
337  SCAN_OPERATION_TYPE scan_op_type; /* SELECT, DELETE, UPDATE */
338 
339  int fixed; /* if true, pages containing scan items in a group keep fixed */
340  int grouped; /* if true, the scan items are accessed group by group, instead of a whole single scan
341  * from beginning to end. */
342  int qualified_block; /* scan block has qualified items, initially set to true */
343  QPROC_SINGLE_FETCH single_fetch; /* scan fetch mode */
344  int single_fetched; /* if true, first qualified scan item already fetched. */
345  int null_fetched; /* if true, null-padding scan item already fetched. used in outer join */
346  QPROC_QUALIFICATION qualification; /* see QPROC_QUALIFICATION; used for both input and output parameter */
347  DB_VALUE *join_dbval; /* A dbval from another table for simple JOIN terms. if set, and unbound, no rows can
348  * match. row or end of scan will be returned with no actual SCAN. */
349  val_list_node *val_list; /* value list */
350  val_descr *vd; /* value descriptor */
351  union
352  {
353  LLIST_SCAN_ID llsid; /* List File Scan Identifier */
354  HEAP_SCAN_ID hsid; /* Regular Heap File Scan Identifier */
355  HEAP_PAGE_SCAN_ID hpsid; /* Scan heap pages without going through records */
356  INDX_SCAN_ID isid; /* Indexed Heap File Scan Identifier */
357  INDEX_NODE_SCAN_ID insid; /* Scan b-tree nodes */
358  SET_SCAN_ID ssid; /* Set Scan Identifier */
359  VA_SCAN_ID vaid; /* Value Array Identifier */
360  REGU_VALUES_SCAN_ID rvsid; /* regu_variable list identifier */
361  SHOWSTMT_SCAN_ID stsid; /* show stmt identifier */
363  } s;
364 
367 }; /* Scan Identifier */
368 
369 #define SCAN_IS_INDEX_COVERED(iscan_id_p) \
370  ((iscan_id_p)->indx_cov.list_id != NULL)
371 #define SCAN_IS_INDEX_MRO(iscan_id_p) ((iscan_id_p)->multi_range_opt.use)
372 #define SCAN_IS_INDEX_ISS(iscan_id_p) ((iscan_id_p)->iss.use)
373 #define SCAN_IS_INDEX_ILS(iscan_id_p) \
374  ((iscan_id_p)->indx_info != NULL \
375  && (iscan_id_p)->indx_info->ils_prefix_len > 0)
376 
377 extern int scan_open_heap_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
378  /* fields of SCAN_ID */
379  bool mvcc_select_lock_needed, SCAN_OPERATION_TYPE scan_op_type, int fixed, int grouped,
380  QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval, val_list_node * val_list,
381  val_descr * vd,
382  /* fields of HEAP_SCAN_ID */
383  OID * cls_oid, HFID * hfid, regu_variable_list_node * regu_list_pred, PRED_EXPR * pr,
384  regu_variable_list_node * regu_list_rest,
385  int num_attrs_pred, ATTR_ID * attrids_pred, HEAP_CACHE_ATTRINFO * cache_pred,
386  int num_attrs_rest, ATTR_ID * attrids_rest, HEAP_CACHE_ATTRINFO * cache_rest,
387  SCAN_TYPE scan_type, DB_VALUE ** cache_recordinfo,
388  regu_variable_list_node * regu_list_recordinfo);
389 extern int scan_open_heap_page_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id, val_list_node * val_list,
390  val_descr * vd, OID * cls_oid, HFID * hfid, PRED_EXPR * pr, SCAN_TYPE scan_type,
391  DB_VALUE ** cache_page_info, regu_variable_list_node * regu_list_page_info);
392 extern int scan_open_class_attr_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
393  /* fields of SCAN_ID */
394  int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval,
395  val_list_node * val_list, val_descr * vd,
396  /* fields of HEAP_SCAN_ID */
397  OID * cls_oid, HFID * hfid, regu_variable_list_node * regu_list_pred,
398  PRED_EXPR * pr, regu_variable_list_node * regu_list_rest, int num_attrs_pred,
399  ATTR_ID * attrids_pred, HEAP_CACHE_ATTRINFO * cache_pred, int num_attrs_rest,
400  ATTR_ID * attrids_rest, HEAP_CACHE_ATTRINFO * cache_rest);
401 extern int scan_open_index_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
402  /* fields of SCAN_ID */
403  bool mvcc_select_lock_needed, SCAN_OPERATION_TYPE scan_op_type, int fixed, int grouped,
404  QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval, val_list_node * val_list,
405  val_descr * vd,
406  /* fields of INDX_SCAN_ID */
407  indx_info * indx_info, OID * cls_oid, HFID * hfid,
408  regu_variable_list_node * regu_list_key, PRED_EXPR * pr_key,
409  regu_variable_list_node * regu_list_pred, PRED_EXPR * pr,
410  regu_variable_list_node * regu_list_rest, PRED_EXPR * pr_range,
411  regu_variable_list_node * regu_list_range, valptr_list_node * output_val_list,
412  regu_variable_list_node * regu_val_list, int num_attrs_key, ATTR_ID * attrids_key,
413  HEAP_CACHE_ATTRINFO * cache_key, int num_attrs_pred, ATTR_ID * attrids_pred,
414  HEAP_CACHE_ATTRINFO * cache_pred, int num_attrs_rest, ATTR_ID * attrids_rest,
415  HEAP_CACHE_ATTRINFO * cache_rest, int num_attrs_range, ATTR_ID * attrids_range,
416  HEAP_CACHE_ATTRINFO * cache_range, bool iscan_oid_order, QUERY_ID query_id);
417 extern int scan_open_index_key_info_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
418  /* fields of SCAN_ID */
419  val_list_node * val_list, val_descr * vd,
420  /* fields of INDX_SCAN_ID */
421  indx_info * indx_info, OID * cls_oid, HFID * hfid, PRED_EXPR * pr,
422  valptr_list_node * output_val_list, bool iscan_oid_order, QUERY_ID query_id,
423  DB_VALUE ** key_info_values, regu_variable_list_node * key_info_regu_list);
424 extern int scan_open_index_node_info_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
425  /* fields of SCAN_ID */
426  val_list_node * val_list, val_descr * vd,
427  /* fields of INDX_SCAN_ID */
428  indx_info * indx_info, PRED_EXPR * pr, DB_VALUE ** node_info_values,
429  regu_variable_list_node * node_info_regu_list);
430 extern int scan_open_list_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
431  /* fields of SCAN_ID */
432  int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval,
433  val_list_node * val_list, val_descr * vd,
434  /* fields of LLIST_SCAN_ID */
435  QFILE_LIST_ID * list_id, regu_variable_list_node * regu_list_pred, PRED_EXPR * pr,
436  regu_variable_list_node * regu_list_rest, regu_variable_list_node * regu_list_build,
437  regu_variable_list_node * regu_list_probe, int hash_list_scan_yn);
438 extern int scan_open_showstmt_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
439  /* fields of SCAN_ID */
440  int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval,
441  val_list_node * val_list, val_descr * vd,
442  /* fields of SHOWSTMT_SCAN_ID */
443  PRED_EXPR * pr, SHOWSTMT_TYPE show_type, regu_variable_list_node * arg_list);
444 extern int scan_open_values_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
445  /* fields of SCAN_ID */
446  int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval,
447  val_list_node * val_list, val_descr * vd,
448  /* fields of REGU_VALUES_SCAN_ID */
449  valptr_list_node * valptr_list);
450 extern int scan_open_set_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
451  /* fields of SCAN_ID */
452  int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval,
453  val_list_node * val_list, val_descr * vd,
454  /* fields of SET_SCAN_ID */
455  regu_variable_node * set_ptr, regu_variable_list_node * regu_list_pred, PRED_EXPR * pr);
456 extern int scan_open_json_table_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id, int grouped,
457  QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval, val_list_node * val_list,
458  val_descr * vd, PRED_EXPR * pr);
459 extern int scan_open_method_scan (THREAD_ENTRY * thread_p, SCAN_ID * scan_id,
460  /* fields of SCAN_ID */
461  int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE * join_dbval,
462  val_list_node * val_list, val_descr * vd,
463  /* */
464  QFILE_LIST_ID * list_id, method_sig_list * meth_sig_list);
465 extern int scan_start_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
466 extern SCAN_CODE scan_reset_scan_block (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
467 extern SCAN_CODE scan_next_scan_block (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
468 extern void scan_end_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
469 extern void scan_close_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
470 extern SCAN_CODE scan_next_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
471 extern SCAN_CODE scan_prev_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
472 extern void scan_save_scan_pos (SCAN_ID * s_id, SCAN_POS * scan_pos);
473 extern SCAN_CODE scan_jump_scan_pos (THREAD_ENTRY * thread_p, SCAN_ID * s_id, SCAN_POS * scan_pos);
474 extern int scan_init_iss (INDX_SCAN_ID * isidp);
475 extern void scan_init_index_scan (INDX_SCAN_ID * isidp, struct btree_iscan_oid_list *oid_list,
477 extern int scan_initialize (void);
478 extern void scan_finalize (void);
479 extern void scan_init_filter_info (FILTER_INFO * filter_info_p, SCAN_PRED * scan_pred, SCAN_ATTRS * scan_attrs,
480  val_list_node * val_list, val_descr * val_descr, OID * class_oid,
481  int btree_num_attrs, ATTR_ID * btree_attr_ids, int *num_vstr_ptr,
482  ATTR_ID * vstr_ids);
483 
484 extern void showstmt_scan_init (void);
485 extern SCAN_CODE showstmt_next_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
486 extern int showstmt_start_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
487 extern int showstmt_end_scan (THREAD_ENTRY * thread_p, SCAN_ID * s_id);
488 
489 #if defined(SERVER_MODE)
490 extern void scan_print_stats_json (SCAN_ID * scan_id, json_t * stats);
491 extern void scan_print_stats_text (FILE * fp, SCAN_ID * scan_id);
492 #endif /* SERVER_MODE */
493 
494 #endif /* _SCAN_MANAGER_H_ */
QPROC_QUALIFICATION qualification
Definition: scan_manager.h:346
regu_variable_node * set_ptr
Definition: scan_manager.h:280
REGU_VALUES_SCAN_ID rvsid
Definition: scan_manager.h:360
val_descr * vd
Definition: scan_manager.h:350
void scan_end_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
int func_index_col_id
Definition: scan_manager.h:135
bool multi_range_opt
Definition: scan_manager.h:321
bool check_not_vacuumed
Definition: scan_manager.h:229
SCAN_PRED scan_pred
Definition: scan_manager.h:118
void scan_save_scan_pos(SCAN_ID *s_id, SCAN_POS *scan_pos)
bool caches_inited
Definition: scan_manager.h:219
regu_variable_list_node * rest_regu_list
Definition: scan_manager.h:252
DB_VALUE ** key_info_values
Definition: scan_manager.h:227
METHOD_SCAN_BUFFER scan_buf
Definition: scan_manager.h:291
QFILE_TUPLE_POSITION ls_tplpos
Definition: scan_manager.h:300
LLIST_SCAN_ID llsid
Definition: scan_manager.h:353
SHOWSTMT_SCAN_ID stsid
Definition: scan_manager.h:361
SCAN_OPERATION_TYPE scan_op_type
Definition: scan_manager.h:337
SCAN_CODE
SCAN_ATTRS pred_attrs
Definition: scan_manager.h:102
bool caches_inited
Definition: scan_manager.h:105
DB_BIGINT key_limit_lower
Definition: scan_manager.h:222
QFILE_LIST_ID * list_id
Definition: scan_manager.h:249
valptr_list_node * output_val_list
Definition: scan_manager.h:131
void showstmt_scan_init(void)
Definition: show_scan.c:100
SCAN_TYPE type
Definition: scan_manager.h:332
QFILE_TUPLE_VALUE_TYPE_LIST * type_list
Definition: scan_manager.h:127
DB_VALUE ** cache_page_info
Definition: scan_manager.h:119
VA_SCAN_ID vaid
Definition: scan_manager.h:359
QPROC_SINGLE_FETCH
Definition: query_list.h:326
int data_qualified_rows
Definition: scan_manager.h:318
BTREE_TYPE
UINT64 num_fetches
Definition: scan_manager.h:307
bool * is_desc_order
Definition: scan_manager.h:156
int scan_open_heap_page_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, val_list_node *val_list, val_descr *vd, OID *cls_oid, HFID *hfid, PRED_EXPR *pr, SCAN_TYPE scan_type, DB_VALUE **cache_page_info, regu_variable_list_node *regu_list_page_info)
MULTI_RANGE_OPT multi_range_opt
Definition: scan_manager.h:225
SCAN_ATTRS range_attrs
Definition: scan_manager.h:212
int qualified_rows
Definition: scan_manager.h:312
bool covered_index
Definition: scan_manager.h:320
DB_BIGINT key_limit_upper
Definition: scan_manager.h:223
bool index_skip_scan
Definition: scan_manager.h:322
int scan_start_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
int scan_open_set_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, regu_variable_node *set_ptr, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr)
QFILE_TUPLE_RECORD * tplrec
Definition: scan_manager.h:128
int qualified_keys
Definition: scan_manager.h:316
int scan_open_showstmt_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, PRED_EXPR *pr, SHOWSTMT_TYPE show_type, regu_variable_list_node *arg_list)
DISK_ISVALID not_vacuumed_res
Definition: scan_manager.h:231
DB_VALUE ** cache_recordinfo
Definition: scan_manager.h:108
int scan_open_method_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, QFILE_LIST_ID *list_id, method_sig_list *meth_sig_list)
RANGE_OPT_ITEM ** buffer
Definition: scan_manager.h:161
SHOWSTMT_TYPE
key_val_range * key_vals
Definition: scan_manager.h:215
SCAN_CODE scan_next_scan_block(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
bool mvcc_select_lock_needed
Definition: scan_manager.h:336
INDX_COV indx_cov
Definition: scan_manager.h:224
SCAN_ATTRS key_attrs
Definition: scan_manager.h:208
void THREAD_ENTRY
int ATTR_ID
regu_variable_list_node * regu_list
Definition: scan_manager.h:273
BTREE_TYPE bt_type
Definition: scan_manager.h:189
INDEX_NODE_SCAN_ID insid
Definition: scan_manager.h:357
ATTR_ID * bt_attr_ids
Definition: scan_manager.h:191
void scan_finalize(void)
BTREE_SCAN bt_scan
Definition: scan_manager.h:195
SCAN_STATUS
HEAP_SCANCACHE scan_cache
Definition: scan_manager.h:99
char * copy_buf
Definition: scan_manager.h:200
SCAN_ATTRS pred_attrs
Definition: scan_manager.h:210
key_range * skipped_range
Definition: scan_manager.h:182
regu_variable_list_node * key_info_regu_list
Definition: scan_manager.h:228
bool scan_immediately_stop
Definition: scan_manager.h:366
QFILE_LIST_SCAN_ID lsid
Definition: scan_manager.h:250
DB_VALUE * join_dbval
Definition: scan_manager.h:347
SCAN_STATUS status
Definition: scan_manager.h:298
SCAN_CODE scan_next_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
RANGE_OPT_ITEM ** top_n_items
Definition: scan_manager.h:160
SCAN_PRED scan_pred
Definition: scan_manager.h:267
BTREE_NODE_SCAN btns
Definition: scan_manager.h:240
int scan_open_list_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, QFILE_LIST_ID *list_id, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, regu_variable_list_node *regu_list_build, regu_variable_list_node *regu_list_probe, int hash_list_scan_yn)
regu_variable_list_node * regu_val_list
Definition: scan_manager.h:132
int scan_open_heap_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, bool mvcc_select_lock_needed, SCAN_OPERATION_TYPE scan_op_type, int fixed, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, OID *cls_oid, HFID *hfid, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, int num_attrs_pred, ATTR_ID *attrids_pred, HEAP_CACHE_ATTRINFO *cache_pred, int num_attrs_rest, ATTR_ID *attrids_rest, HEAP_CACHE_ATTRINFO *cache_rest, SCAN_TYPE scan_type, DB_VALUE **cache_recordinfo, regu_variable_list_node *regu_list_recordinfo)
bool scancache_inited
Definition: scan_manager.h:220
SCAN_CODE scan_prev_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
HEAP_SCAN_ID hsid
Definition: scan_manager.h:354
VAL_DESCR * val_descr
Definition: scan_manager.h:130
HEAP_SCANCACHE scan_cache
Definition: scan_manager.h:206
SCAN_POSITION
int scan_initialize(void)
SCAN_POSITION position
Definition: scan_manager.h:334
bool loose_index_scan
Definition: scan_manager.h:323
SCAN_OPERATION_TYPE
SCAN_STATUS status
Definition: scan_manager.h:333
QFILE_LIST_SCAN_ID * lsid
Definition: scan_manager.h:129
INDX_INFO * indx_info
Definition: scan_manager.h:188
SCAN_CODE scan_reset_scan_block(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
SCAN_DIRECTION direction
Definition: scan_manager.h:335
SHOWSTMT_TYPE show_type
Definition: scan_manager.h:260
TP_DOMAIN ** sort_col_dom
Definition: scan_manager.h:159
int max_tuples
Definition: scan_manager.h:134
int scan_open_class_attr_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, OID *cls_oid, HFID *hfid, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, int num_attrs_pred, ATTR_ID *attrids_pred, HEAP_CACHE_ATTRINFO *cache_pred, int num_attrs_rest, ATTR_ID *attrids_rest, HEAP_CACHE_ATTRINFO *cache_rest)
QFILE_TUPLE_RECORD tplrec
Definition: scan_manager.h:158
SCAN_PRED scan_pred
Definition: scan_manager.h:285
int64_t DB_BIGINT
Definition: dbtype_def.h:751
UINT64 num_ioreads
Definition: scan_manager.h:308
bool scancache_inited
Definition: scan_manager.h:106
regu_variable_list_node * operand
Definition: scan_manager.h:281
bool scanrange_inited
Definition: scan_manager.h:107
HASH_LIST_SCAN hlsid
Definition: scan_manager.h:254
DB_VALUE index_value
Definition: scan_manager.h:144
regu_variable_list_node * rest_regu_list
Definition: scan_manager.h:213
ISS_OP_TYPE
Definition: scan_manager.h:168
int showstmt_start_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
Definition: show_scan.c:283
INDX_INFO * indx_info
Definition: scan_manager.h:238
int scan_open_index_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, bool mvcc_select_lock_needed, SCAN_OPERATION_TYPE scan_op_type, int fixed, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, indx_info *indx_info, OID *cls_oid, HFID *hfid, regu_variable_list_node *regu_list_key, PRED_EXPR *pr_key, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, PRED_EXPR *pr_range, regu_variable_list_node *regu_list_range, valptr_list_node *output_val_list, regu_variable_list_node *regu_val_list, int num_attrs_key, ATTR_ID *attrids_key, HEAP_CACHE_ATTRINFO *cache_key, int num_attrs_pred, ATTR_ID *attrids_pred, HEAP_CACHE_ATTRINFO *cache_pred, int num_attrs_rest, ATTR_ID *attrids_rest, HEAP_CACHE_ATTRINFO *cache_rest, int num_attrs_range, ATTR_ID *attrids_range, HEAP_CACHE_ATTRINFO *cache_range, bool iscan_oid_order, QUERY_ID query_id)
SCAN_PRED scan_pred
Definition: scan_manager.h:209
val_list_node * val_list
Definition: scan_manager.h:349
QFILE_TUPLE_RECORD * tplrecp
Definition: scan_manager.h:253
int key_qualified_rows
Definition: scan_manager.h:317
DB_VALUE * fetched_values
Definition: scan_manager.h:232
QPROC_QUALIFICATION
regu_variable_list_node * recordinfo_regu_list
Definition: scan_manager.h:109
SCAN_PRED range_pred
Definition: scan_manager.h:211
int scan_open_json_table_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, PRED_EXPR *pr)
int scan_open_values_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, val_descr *vd, valptr_list_node *valptr_list)
SCAN_ATTRS rest_attrs
Definition: scan_manager.h:214
int * bt_attrs_prefix_length
Definition: scan_manager.h:192
SCAN_STATS scan_stats
Definition: scan_manager.h:365
INDEX_SKIP_SCAN iss
Definition: scan_manager.h:226
HEAP_PAGE_SCAN_ID hpsid
Definition: scan_manager.h:355
regu_variable_list_node * page_info_regu_list
Definition: scan_manager.h:120
regu_variable_list_node * rest_regu_list
Definition: scan_manager.h:103
int showstmt_end_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
Definition: show_scan.c:309
void scan_init_index_scan(INDX_SCAN_ID *isidp, struct btree_iscan_oid_list *oid_list, MVCC_SNAPSHOT *mvcc_snapshot)
Definition: scan_manager.c:283
int scan_init_iss(INDX_SCAN_ID *isidp)
Definition: scan_manager.c:214
SCAN_TYPE
Definition: scan_manager.h:75
bool iscan_oid_order
Definition: scan_manager.h:217
bool need_count_only
Definition: scan_manager.h:218
SCAN_PRED scan_pred
Definition: scan_manager.h:101
SCAN_CODE scan_jump_scan_pos(THREAD_ENTRY *thread_p, SCAN_ID *s_id, SCAN_POS *scan_pos)
DB_VALUE ** node_info_values
Definition: scan_manager.h:242
SCAN_PRED key_pred
Definition: scan_manager.h:207
HEAP_SCANRANGE scan_range
Definition: scan_manager.h:100
SCAN_POSITION position
Definition: scan_manager.h:299
QPROC_SINGLE_FETCH single_fetch
Definition: scan_manager.h:343
DB_VALUE ** arg_values
Definition: scan_manager.h:261
JSON_TABLE_SCAN_ID jtid
Definition: scan_manager.h:362
INDX_SCAN_ID isid
Definition: scan_manager.h:356
int scan_open_index_node_info_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, val_list_node *val_list, val_descr *vd, indx_info *indx_info, PRED_EXPR *pr, DB_VALUE **node_info_values, regu_variable_list_node *node_info_regu_list)
SET_SCAN_ID ssid
Definition: scan_manager.h:358
void scan_init_filter_info(FILTER_INFO *filter_info_p, SCAN_PRED *scan_pred, SCAN_ATTRS *scan_attrs, val_list_node *val_list, val_descr *val_descr, OID *class_oid, int btree_num_attrs, ATTR_ID *btree_attr_ids, int *num_vstr_ptr, ATTR_ID *vstr_ids)
Definition: scan_manager.c:660
ISS_OP_TYPE current_op
Definition: scan_manager.h:181
ATTR_ID * vstr_ids
Definition: scan_manager.h:193
QUERY_ID query_id
Definition: scan_manager.h:133
int scan_open_index_key_info_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, val_list_node *val_list, val_descr *vd, indx_info *indx_info, OID *cls_oid, HFID *hfid, PRED_EXPR *pr, valptr_list_node *output_val_list, bool iscan_oid_order, QUERY_ID query_id, DB_VALUE **key_info_values, regu_variable_list_node *key_info_regu_list)
BTREE_ISCAN_OID_LIST * oid_list
Definition: scan_manager.h:201
SCAN_CODE showstmt_next_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
Definition: show_scan.c:250
SCAN_DIRECTION
regu_variable_list_node * node_info_regu_list
Definition: scan_manager.h:243
DB_VALUE ** out_values
Definition: scan_manager.h:263
SCAN_ATTRS rest_attrs
Definition: scan_manager.h:104
QFILE_LIST_ID * list_id
Definition: scan_manager.h:126
DISK_ISVALID
Definition: disk_manager.h:53
SCAN_PRED scan_pred
Definition: scan_manager.h:251
void scan_close_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)