64 #define SIZEOF_USING_INDEX(n) \ 65 (sizeof(QO_USING_INDEX) + (((n)-1) * sizeof(QO_USING_INDEX_ENTRY))) 68 #define PREDICATE_TERM -2 70 #define RANK_DEFAULT 0 71 #define RANK_NAME RANK_DEFAULT 72 #define RANK_VALUE RANK_DEFAULT 73 #define RANK_EXPR_LIGHT 1 74 #define RANK_EXPR_MEDIUM 2 75 #define RANK_EXPR_HEAVY 3 76 #define RANK_EXPR_FUNCTION 4 82 #define LOG2_SIZEOF_POINTER 3 85 #define LOG2_SIZEOF_POINTER 2 91 #define SIZEOF_INDEX(n) \ 92 (sizeof(QO_INDEX) + (((n)-1)* sizeof(QO_INDEX_ENTRY))) 97 #define SIZEOF_CLASS_INFO(n) \ 98 (sizeof(QO_CLASS_INFO) + (((n)-1) * sizeof(QO_CLASS_INFO_ENTRY))) 103 #define SIZEOF_ATTR_CUM_STATS_PKEYS(n) \ 106 #define NOMINAL_HEAP_SIZE(class) 200 107 #define NOMINAL_OBJECT_SIZE(class) 64 110 #define SIZEOF_NODE_INDEX(n) \ 111 (sizeof(QO_NODE_INDEX) + (((n)-1)* sizeof(QO_NODE_INDEX_ENTRY))) 113 #define EXCHANGE_BUILDER(type,e0,e1) \ 114 do { type _tmp = e0; e0 = e1; e1 = _tmp; } while (0) 116 #define TERMCLASS_EXCHANGE(e0,e1) EXCHANGE_BUILDER(QO_TERMCLASS,e0,e1) 117 #define DOUBLE_EXCHANGE(e0,e1) EXCHANGE_BUILDER(double,e0,e1) 118 #define PT_NODE_EXCHANGE(e0,e1) EXCHANGE_BUILDER(PT_NODE *,e0,e1) 119 #define INT_EXCHANGE(e0,e1) EXCHANGE_BUILDER(int,e0,e1) 120 #define SEGMENTPTR_EXCHANGE(e0,e1) EXCHANGE_BUILDER(QO_SEGMENT *,e0,e1) 121 #define NODEPTR_EXCHANGE(e0,e1) EXCHANGE_BUILDER(QO_NODE *,e0,e1) 122 #define EQCLASSPTR_EXCHANGE(e0,e1) EXCHANGE_BUILDER(QO_EQCLASS *,e0,e1) 123 #define BOOL_EXCHANGE(e0,e1) EXCHANGE_BUILDER(bool,e0,e1) 124 #define JOIN_TYPE_EXCHANGE(e0,e1) EXCHANGE_BUILDER(JOIN_TYPE,e0,e1) 125 #define FLAG_EXCHANGE(e0,e1) EXCHANGE_BUILDER(int,e0,e1) 126 #define INT_PTR_EXCHANGE(e0,e1) EXCHANGE_BUILDER(int *,e0,e1) 128 #define BISET_EXCHANGE(s0,s1) \ 131 BITSET_MOVE(tmp, s0); \ 132 BITSET_MOVE(s0, s1); \ 133 BITSET_MOVE(s1, tmp); \ 136 #define PUT_FLAG(cond, flag) \ 139 if (extra_info++) { \ 165 const char *expr_str);
274 va_start (args, param);
282 buf = (
char *) retval;
319 va_start (args, param);
333 const char *plan_name;
336 plan_name = va_arg (args,
char *);
337 cost_fn = va_arg (args,
int);
341 *(
const char **) retval = plan_name;
386 switch (setjmp (env->
catch_))
415 #if defined(CUBRID_DEBUG) 416 fprintf (stderr,
"*** optimizer aborting ***\n");
459 for (n = 0; n < env->
nnodes; n++)
543 for (n = 1; n < env->
nnodes; n++)
711 for (i = 0; i < env->
nsegs; ++
i)
716 for (i = 0; i < env->
nnodes; ++
i)
721 for (i = 0; i < env->
nterms; ++
i)
760 #define OPTIMIZATION_LIMIT 64 858 PT_NODE *name, *conj, *next_entity;
879 while (constraints !=
NULL)
885 constraints = constraints->
next;
1009 UINTPTR spec_id = 0;
1016 const char *seg_name;
1025 for (i = 0; i < env->
nnodes; i++)
1041 while (constraints !=
NULL)
1047 if (expr_str !=
NULL 1050 for (i = 0; i < env->
nsegs; i++)
1065 if (i == env->
nsegs)
1080 constraints = constraints->
next;
1107 PT_NODE *name, *next_entity, *attr, *attr_list;
1114 for (i = 0; i < env->
nnodes; i++)
1173 for (name = attr_list; name !=
NULL; name = name->
next)
1271 for (i = 0, n = info->
n; i < n; i++)
1449 for (i = 0; (!found) && (i < env->nnodes); )
1571 if (expr_str !=
NULL)
1573 for (i = 0; (!found) && (i < env->nsegs); i++)
1597 for (i = 0; (!found) && (i < env->nsegs); )
1920 bool lhs_indexable, rhs_indexable;
1924 BITSET lhs_segs, rhs_segs, lhs_nodes, rhs_nodes, multi_col_segs;
1927 int i, n, t, segs, j;
1935 merge_applies =
true;
1936 lhs_indexable = rhs_indexable =
false;
1937 lhs_expr = rhs_expr =
NULL;
1972 rhs_indexable =
true;
1993 for (; between_and; between_and = between_and->
or_next)
2001 if (between_and ==
NULL)
2017 lhs_indexable =
true;
2125 lhs_indexable =
false;
2129 lhs_indexable =
false;
2135 lhs_indexable =
true;
2141 func_arg = lhs_expr->info.function.arg_list;
2149 lhs_indexable =
false;
2155 lhs_indexable =
false;
2159 lhs_indexable =
false;
2166 bool is_find_local_name =
false;
2167 for ( ; func_arg; func_arg = func_arg->next)
2175 lhs_indexable =
false;
2178 is_find_local_name =
true;
2187 lhs_indexable =
false;
2192 if (!is_find_local_name)
2194 lhs_indexable =
false;
2205 func_arg = lhs_expr->info.function.arg_list;
2206 for (j = 0; func_arg; func_arg = func_arg->next)
2216 lhs_indexable =
false;
2221 || (lhs_expr && lhs_expr->info.expr.op ==
PT_PRIOR 2230 lhs_indexable =
false;
2233 if (lhs_indexable && rhs_expr->next ==
NULL)
2243 switch (rhs_expr->node_type)
2249 lhs_indexable =
false;
2254 lhs_indexable =
false;
2260 lhs_indexable =
false;
2264 if (op_type ==
PT_EQ_SOME && rhs_expr->info.value.db_value_is_initialized
2272 lhs_indexable =
false;
2290 if (lhs_indexable || rhs_indexable)
2292 int has_nis_coll = 0;
2300 lhs_indexable =
false;
2301 rhs_indexable =
false;
2335 rhs_indexable =
false;
2339 rhs_indexable =
false;
2345 rhs_indexable =
true;
2350 rhs_indexable =
false;
2355 || (rhs_expr && rhs_expr->info.expr.op ==
PT_PRIOR 2364 rhs_indexable =
false;
2404 merge_applies =
false;
2439 bool inst_num =
false;
2468 swap_node = head_node;
2469 head_node = tail_node;
2505 merge_applies =
false;
2531 swap_seg = head_seg;
2532 head_seg = tail_seg;
2533 tail_seg = swap_seg;
2556 merge_applies =
false;
2662 for (t = 0; t < env->
nterms - 1; t++)
2669 if (head_node ==
NULL)
2738 if (pt_expr ==
NULL)
2745 next = pt_expr->
next;
2754 pt_expr->
next = next;
3003 if (pt_expr ==
NULL)
3008 next = pt_expr->
next;
3016 pt_expr->
next = next;
3422 if (
function ==
NULL)
3473 if (pt_expr ==
NULL)
4031 for (i = 0; i < n; i++)
4160 next_ptr = tree->
next;
4168 tree->
next = next_ptr;
4175 for (i = 0; i < env->
nterms; i++)
4195 for (i = 0; i < env->
nterms; i++)
4231 for (i = 0; i < env->
nnodes; i++)
4236 for (arg = arg_list; arg; arg = arg->
next)
4250 for (i = 0; i < env->
nnodes; i++)
4271 PT_NODE *arg, *p_arg, *spec, *p_spec;
4272 int last_ordered_idx = 0;
4285 for (i = 0; i < env->
nnodes; i++)
4297 for (i = 0; i < env->
nnodes; i++)
4310 for (k = 0; k < env->
nnodes; k++)
4345 for (i = 0; i < env->
nnodes; i++)
4399 PT_NODE *indexp, *indexp_nokl;
4400 bool is_none, is_ignored;
4402 int idx_ignore_list_capacity = 0;
4403 int idx_ignore_list_size = 0;
4414 idx_ignore_list_capacity = 0;
4415 for (indexp = using_index; indexp; indexp = indexp->
next)
4417 idx_ignore_list_capacity++;
4420 idx_ignore_list = (
PT_NODE **) malloc (idx_ignore_list_capacity *
sizeof (
PT_NODE *));
4421 if (idx_ignore_list ==
NULL)
4424 idx_ignore_list_capacity *
sizeof (
PT_NODE *));
4431 idx_ignore_list_size = 0;
4432 for (indexp_nokl = using_index; indexp_nokl; indexp_nokl = indexp_nokl->
next)
4437 for (indexp = using_index; indexp; indexp = indexp->
next)
4440 && indexp->
etc == indexp_nokl->
etc 4445 idx_ignore_list[idx_ignore_list_size++] = indexp_nokl;
4453 for (i = 0; i < env->
nnodes; i++)
4460 for (indexp = using_index; indexp; indexp = indexp->
next)
4480 for (j = 0; j < idx_ignore_list_size; j++)
4482 if (indexp == idx_ignore_list[j])
4505 if (n == 0 && !is_none)
4539 for (indexp = using_index; indexp; indexp = indexp->
next)
4549 for (j = 0; j < idx_ignore_list_size; j++)
4551 if (indexp == idx_ignore_list[j])
4580 if (idx_ignore_list !=
NULL)
4582 free (idx_ignore_list);
4610 for (i = 0; i < n; i++)
4661 for (i = 0; i < indexp->
max; i++)
4667 for (j = 0; j < entryp->
nsegs; j++)
4725 for (i = 0; i < n; ++
i)
4769 for (i = 0; i < info->
n; ++
i)
4796 for (n = 0;
p; p = p->
next)
4825 for (;
p; p = p->
next)
4848 if (smclass ==
NULL)
4923 if (attr_infop ==
NULL)
4934 cum_statsp->
keys = 0;
4940 for (i = 0; i < n; class_info_entryp++, i++)
4971 for (j = 0; j < n_attrs; j++, attr_statsp++)
4973 if (attr_statsp->
id == attr_id)
4985 for (j = 0; j < attr_statsp->
n_btstats; j++, bstatsp++)
5000 assert (j < attr_statsp->n_btstats);
5015 if (cum_statsp->
pkeys)
5062 int n_unavail_indexes;
5065 bool is_reserved_name =
false;
5069 is_reserved_name =
true;
5092 if (attr_infop ==
NULL)
5100 if (is_reserved_name)
5106 cum_statsp->
keys = 0;
5119 cum_statsp->
keys = 0;
5125 for (i = 0; i < n; class_info_entryp++, i++)
5153 for (j = 0; j < n_attrs; j++, attr_statsp++)
5155 if (attr_statsp->
id == attr_id)
5170 cum_statsp->
type = attr_statsp->
type;
5175 n_unavail_indexes = 0;
5176 for (j = 0; j < attr_statsp->
n_btstats; j++)
5185 n_unavail_indexes++;
5189 if ((attr_statsp->
n_btstats - (n_func_indexes + n_unavail_indexes) <= 0) || (!attr_statsp->
bt_stats))
5203 bt_statsp = &attr_statsp->
bt_stats[0];
5204 for (j = 1; j < attr_statsp->
n_btstats; j++)
5208 bt_statsp = &attr_statsp->
bt_stats[j];
5231 cum_statsp->
keys = bt_statsp->
keys;
5268 cum_statsp->
keys < bt_statsp->
keys)
5270 cum_statsp->
keys = bt_statsp->
keys;
5274 if (cum_statsp->
pkeys)
5315 if (cum_statsp->
pkeys)
5340 int attr_id, n_attrs;
5351 for (i = 0, ni_entryp =
QO_NI_ENTRY (node_indexp, 0); i <
QO_NI_N (node_indexp); i++, ni_entryp++)
5353 cum_statsp = &(ni_entryp)->cum_stats;
5360 for (j = 0, index_entryp = (ni_entryp)->head; index_entryp !=
NULL; j++, index_entryp = index_entryp->
next)
5369 for (k = 0; k < index_entryp->nsegs; k++)
5371 if (index_entryp->seg_idxs[k] != -1)
5373 segp =
QO_ENV_SEG (env, (index_entryp->seg_idxs[k]));
5384 index_entryp->key_type =
NULL;
5399 name = index_entryp->statistics_attribute_name;
5413 if (!index_entryp->is_func_index)
5420 attr_id = index_entryp->constraints->attributes[0]->id;
5423 for (k = 0; k < n_attrs; k++, attr_statsp++)
5425 if (attr_statsp->
id == attr_id)
5431 index_entryp->key_type =
NULL;
5441 cum_statsp->
type = attr_statsp->
type;
5447 for (k = 0; k < attr_statsp->
n_btstats; k++, bt_statsp++)
5451 if (!index_entryp->is_func_index || bt_statsp->
has_function == 1)
5476 cum_statsp->
keys = bt_statsp->
keys;
5480 if (cum_statsp->
pkeys)
5512 cum_statsp->
keys < bt_statsp->
keys)
5514 cum_statsp->
keys = bt_statsp->
keys;
5518 if (cum_statsp->
pkeys)
5558 for (i = 0, ni_entryp =
QO_NI_ENTRY (node_indexp, 0); i <
QO_NI_N (node_indexp); i++, ni_entryp++)
5560 cum_statsp = &(ni_entryp)->cum_stats;
5561 if (cum_statsp->
pkeys)
5589 result = (data1->
i < data2->
i) ? -1 : ((data1->
i > data2->
i) ? 1 : 0);
5592 result = ((data1->
sh < data2->
sh) ? -1 : ((data1->
sh > data2->
sh) ? 1 : 0));
5598 result = (data1->
f < data2->
f) ? -1 : ((data1->
f > data2->
f) ? 1 : 0);
5601 result = (data1->
d < data2->
d) ? -1 : ((data1->
d > data2->
d) ? 1 : 0);
5604 result = ((data1->
date < data2->
date) ? -1 : ((data1->
date > data2->
date) ? 1 : 0));
5607 result = ((data1->
time < data2->
time) ? -1 : ((data1->
time > data2->
time) ? 1 : 0));
5774 qo_malloc (
QO_ENV *
env,
unsigned size,
const char *file,
int line)
5781 longjmp (env->catch, 1);
5799 longjmp (env->
catch_, 2);
5824 for (i = 0; i < env->
Nsegs; ++
i)
5833 for (i = 0; i < env->
Nnodes; ++
i)
5851 for (i = 0; i < env->
Nterms; ++
i)
5978 for (t1 = 0; t1 < i - 1; t1++)
5981 for (t2 = t1 + 1; t2 <
i; t2++)
5991 for (t1 = i; t1 < env->
nterms - 1; t1++)
5994 for (t2 = t1 + 1; t2 < env->
nterms; t2++)
6004 for (n = env->
nterms; i < n; i++)
6020 for (i = 0, n = env->
nedges; i < n; i++)
6028 for (j = 0; j < n; j++)
6045 for (j = 0; j < n; j++)
6101 bool is_null_padded, is_outerjoin_for_or_pred;
6107 BITSET dep_set, prev_dep_set;
6109 for (i = 0; i < env->
nterms; i++)
6128 for (i = 0; i < env->
nterms; i++)
6161 is_outerjoin_for_or_pred =
false;
6168 is_outerjoin_for_or_pred =
true;
6171 QO_ASSERT (env, nidx_self < env->nnodes);
6265 is_null_padded =
false;
6275 for (n = 0; n < env->
nnodes; n++)
6292 is_null_padded =
true;
6321 is_null_padded =
true;
6327 is_null_padded =
true;
6331 if (!is_null_padded)
6380 for (t = 0; t < env->
nterms; t++)
6423 for (t = 0; t < env->
nterms; t++)
6505 for (i = 0; i < index1->
nsegs; i++)
6537 for (i = 0; i < class_indexes->
n; i++)
6554 if (i < class_indexes->n)
6588 if (n >= class_info->
n)
6593 class_entry = &(class_info->
info[n]);
6594 class_indexes = class_entry->
index;
6603 if (n == (class_info->
n - 1))
6637 int *nseg_idxp,
BITSET * segs)
6645 int count_matched_index_attributes = 0;
6652 for (i = 0; *nseg_idxp < seg_idx_num; i++)
6666 seg_idx[*nseg_idxp] = iseg;
6673 count_matched_index_attributes++;
6679 seg_idx[*nseg_idxp] = -1;
6684 if (*nseg_idxp == seg_idx_num)
6702 seg_idx[*nseg_idxp] = iseg;
6708 count_matched_index_attributes++;
6716 seg_idx[*nseg_idxp] = -1;
6724 return count_matched_index_attributes > 0;
6746 if (env ==
NULL || nodep ==
NULL || index_entry ==
NULL)
6762 for (i = 0; i < index_entry->
nsegs; i++)
6779 for (i = 0; i < env->
nsegs; i++)
6791 for (j = 0; j < env->
nterms; j++)
6809 if (seg_nodep ==
NULL || seg_nodep != nodep)
6822 for (j = 0; j < class_infop->
n; j++)
6836 for (j = 0; j < index_entry->
col_num; j++)
6869 int prefix_len = 0,
i;
6872 if (env ==
NULL || nodep ==
NULL || index_entry ==
NULL)
6927 for (
i = index_entry->
nsegs - 1;
i >= 0;
i--)
6943 if (prefix_len == -1 || prefix_len == index_entry->
col_num)
6982 bool first_col_present =
false, second_col_present =
false;
6984 if (env ==
NULL || nodep ==
NULL || index_entry ==
NULL)
7032 for (i = 0; i < index_entry->
nsegs; i++)
7041 first_col_present =
false;
7042 if (index_entry->
seg_idxs[0] != -1)
7052 first_col_present =
true;
7056 if (first_col_present)
7061 second_col_present =
false;
7062 if (index_entry->
seg_idxs[1] != -1)
7072 second_col_present =
true;
7076 if (!second_col_present)
7127 int i, j, n, col_num;
7136 int *seg_idx, seg_idx_arr[
NELEMENTS], nseg_idx;
7137 bool found, is_hint_use, is_hint_ignore, is_hint_force, is_hint_all_except;
7138 BITSET index_segs, index_terms;
7139 bool special_index_scan =
false;
7144 if (class_infop->
n <= 0)
7156 special_index_scan =
true;
7162 for (i = 0; i < class_infop->
n; i++)
7166 class_entryp = &(class_infop->
info[
i]);
7183 for (consp = constraints; consp; consp = consp->
next)
7203 for (consp = constraints; consp; consp = consp->
next)
7222 is_hint_use = is_hint_force = is_hint_ignore =
false;
7223 is_hint_all_except =
false;
7226 for (j = 0; j <
QO_UI_N (uip); j++)
7234 is_hint_force =
true;
7237 is_hint_ignore =
true;
7240 is_hint_all_except =
true;
7246 for (j = 0; j <
QO_UI_N (uip); j++)
7270 else if (is_hint_force || is_hint_use)
7300 for (col_num = 0; consp->
attributes[col_num]; col_num++)
7311 seg_idx = seg_idx_arr;
7316 seg_idx = (
int *) malloc (
sizeof (
int) * col_num);
7317 if (seg_idx ==
NULL)
7321 seg_idx = seg_idx_arr;
7327 found =
qo_find_index_segs (env, consp, nodep, seg_idx, col_num, &nseg_idx, &index_segs);
7335 if (found ==
true || special_index_scan ==
true)
7341 index_entryp->
nsegs = nseg_idx;
7346 if (index_entryp->
nsegs > 0)
7350 size =
sizeof (int) * index_entryp->
nsegs;
7351 index_entryp->
seg_idxs = (
int *) malloc (size);
7354 if (seg_idx != seg_idx_arr)
7367 if (seg_idx != seg_idx_arr)
7379 if (seg_idx != seg_idx_arr)
7387 index_entryp->
class_ = class_entryp;
7390 index_entryp->
col_num = col_num;
7398 for (j = 0; j < index_entryp->
nsegs; j++)
7402 index_entryp->
seg_idxs[j] = seg_idx[j];
7403 if (index_entryp->
seg_idxs[j] != -1)
7427 if (index_entryp->
col_num > 0)
7429 const char *temp_name =
NULL;
7440 size_t len =
strlen (temp_name) + 1;
7444 if (seg_idx != seg_idx_arr)
7449 sizeof (
char) * len);
7463 if (seg_idx != seg_idx_arr)
7484 if (node_indexp ==
NULL)
7498 for (i = 0; i < indexp->
n; i++)
7504 if ((index_entryp->
next !=
NULL) || (class_infop->
n == 1))
7509 (ni_entryp)->n = class_infop->
n;
7511 (ni_entryp)->head = index_entryp;
7532 int i, j, k, b, n, s;
7543 for (i = 0; i < env->
nnodes; i++)
7572 for (i = 0; i < env->
nterms; i++)
7594 if (node_indexp ==
NULL)
7601 for (n = 0, ni_entryp =
QO_NI_ENTRY (node_indexp, 0); n <
QO_NI_N (node_indexp) && !found;
7605 index_entryp = (ni_entryp)->head;
7608 for (s = 0; s < index_entryp->
nsegs && !found; s++)
7658 int M_offset, join_info_size;
7664 buddy = (
int *) malloc (
sizeof (
int) * (2 * N));
7676 partition = buddy + N;
7683 for (n = 0; n < N; ++n)
7689 for (e = 0; e < E; ++e)
7698 while (hi != -1 && buddy[hi] != -1)
7711 while (buddy[ti] != -1)
7728 for (n = 0; n < N; ++n)
7730 if (partition[n] == -1)
7736 while (buddy[r] != -1)
7744 if (partition[r] == -1)
7762 partition[n] = partition[r];
7775 for (p = 0; p < P; ++
p)
7779 for (e = 0; e < E; ++e)
7807 if (INT_MAX - M_offset *
sizeof (
QO_INFO *) < join_info_size *
sizeof (
QO_INFO *))
7815 M_offset += join_info_size;
7859 for (i = 0; i < env->
nsegs; ++
i)
7864 for (i = 0; i < env->
nedges; i++)
7879 for (i = 0; i < env->
nsegs; ++
i)
7886 if (eq_map[i] ==
NULL)
7933 for (i = 0; i < env->
nedges; i++)
7967 fprintf (f,
"Non recursive part of CTE:\n");
7971 fprintf (f,
"Recursive part of CTE:\n");
7981 fprintf (f,
"Join graph segments (f indicates final):\n");
7982 for (i = 0; i < env->
nsegs; ++
i)
7987 fprintf (f,
"seg[%d]: ", i);
7994 fputs (extra_info ?
")\n" :
"\n", f);
8000 fprintf (f,
"Join graph nodes:\n");
8001 for (i = 0; i < env->
nnodes; ++
i)
8004 fprintf (f,
"node[%d]: ", i);
8012 fprintf (f,
"Join graph equivalence classes:\n");
8015 fprintf (f,
"eqclass[%d]: ", i);
8029 fputs (
"Join graph edges:\n", f);
8030 for (i = 0; i < env->
nedges; ++
i)
8032 fprintf (f,
"term[%d]: ", i);
8040 fputs (
"Join graph terms:\n", f);
8041 for (i = env->
nedges; i < env->nterms; ++i)
8043 fprintf (f,
"term[%d]: ", i);
8051 fputs (
"Join graph subqueries:\n", f);
8054 fprintf (f,
"subquery[%d]: ", i);
8062 fputs (
"Join graph partitions:\n", f);
8065 fprintf (f,
"partition[%d]: ", i);
8193 for (i = 0; i < n; i++)
8200 (name ? name :
"(anon)"));
8205 (name ? name :
"(anon)"));
8208 fprintf (f,
"%s ", (n > 1 ?
")" :
""));
8213 fprintf (f,
"%s", (name ? name :
"(unknown)"));
8217 fprintf (f,
"as %s", (name ? name :
"(unknown)"));
8228 fputs (
" (sargs ", f);
8234 fputs (
" (outer-dep-set ", f);
8240 fputs (
" (dep-set ", f);
8246 fputs (
" (right-dep-set ", f);
8334 return sizeof (int);
8344 size = size * (2 / 3);
8350 return MAX ((
int)
sizeof (
int), size);
8424 const char *prefix =
"";
8495 PT_NODE *query, *orderby, *sort_col, *select_list, *col, *save_next;
8496 int i, pos_spec, limit_max_count;
8498 BITSET order_nodes, dep_nodes, expr_segs, tmp_bitset;
8507 goto abandon_stop_limit;
8512 goto abandon_stop_limit;
8516 goto abandon_stop_limit;
8522 goto abandon_stop_limit;
8528 goto abandon_stop_limit;
8534 goto abandon_stop_limit;
8538 if (orderby ==
NULL)
8540 goto abandon_stop_limit;
8548 for (i = 0; i < env->
nterms; i++)
8552 goto abandon_stop_limit;
8567 for (sort_col = orderby; sort_col !=
NULL; sort_col = sort_col->
next)
8571 goto abandon_stop_limit;
8580 for (i = 1, col = select_list; col !=
NULL && i != pos_spec; col = col->
next, i++);
8585 goto abandon_stop_limit;
8588 save_next = col->
next;
8593 col->
next = save_next;
8594 goto abandon_stop_limit;
8608 col->
next = save_next;
8628 goto abandon_stop_limit;
8640 goto sort_limit_possible;
8644 if (limit_max_count == 0)
8647 goto abandon_stop_limit;
8655 goto sort_limit_possible;
8669 sort_limit_possible:
8744 fputs (
"UNORDERED", f);
8804 fprintf (f,
" () -> ");
8814 fprintf (f,
"table(");
8816 fprintf (f,
") -> ");
8822 fprintf (f,
" <dj> ");
8833 fprintf (f,
"none");
8849 const char *prefix =
"";
8874 saved_next = conj->
next;
8885 fprintf (f,
" () -> ");
8895 fprintf (f,
"table(");
8897 fprintf (f,
") -> ");
8903 fprintf (f,
" <dj> ");
8944 fprintf (f,
" (path term)");
8947 fprintf (f,
" (join term)");
8950 fprintf (f,
" (sarg term)");
8957 fprintf (f,
" (dummy sarg term)");
8961 fprintf (f,
" (other term)");
8966 fprintf (f,
" (dep term)");
8969 fprintf (f,
" (dep-join term)");
8972 fprintf (f,
" (during join term)");
8975 fprintf (f,
" (after join term)");
8978 fprintf (f,
" (instnum term)");
8981 fprintf (f,
" (dummy join term)");
8989 fputs (
" (mergeable)", f);
8995 fputs (
" (not-join eligible)", f);
8999 fputs (
" (inner-join)", f);
9003 fputs (
" (left-join)", f);
9007 fputs (
" (right-join)", f);
9011 fputs (
" (outer-join)", f);
9021 fputs (
" (indexable", f);
9035 conj->
next = saved_next;
9051 const char *separator;
9053 fprintf (f,
"%p", (
void *) subq->
node);
9061 fputs (separator, f);
9072 fprintf (f,
"%snode[%d]", separator, i);
9077 fputs (
" (from term(s)", f);
9080 fprintf (f,
" %d", i);
9151 fputs (
"(nodes ", f);
9153 fputs (
") (edges ", f);
9155 fputs (
") (dependencies ", f);
9171 #if defined (CUBRID_DEBUG) 9357 for (i = 0; i < env->
nedges; i++)
9428 if (node_indexp ==
NULL)
9434 for (i = 0; i <
QO_NI_N (node_indexp); i++)
9452 if (node_indexp ==
NULL)
9458 for (i = 0; i <
QO_NI_N (node_indexp); i++)
9481 for (i = 0; i < pk_idx->
nsegs; i++)
9491 for (j = i + 1; j < pk_idx->
nsegs; j++)
9502 if (pk_idx->
nsegs > fk_idx->nsegs)
9513 for (i = 0; i < env->
nterms; i++)
9573 for (j = 0; j < pk_idx->
nsegs; j++)
9577 assert (j < fk_idx->nsegs);
9578 if (fk_idx->seg_idxs[j] !=
QO_SEG_IDX (fk_seg))
static void qo_partition_free(QO_PARTITION *)
static void qo_node_dump(QO_NODE *, FILE *)
static int count_bits(const unsigned char *mem, int nbits)
static bool expr_is_mergable(PT_NODE *pt_expr)
QO_CLASS_INFO_ENTRY * class_
#define QO_TERM_SUBQUERIES(t)
QO_PARTITION * partitions
int tp_domain_disk_size(TP_DOMAIN *domain)
QFILE_TUPLE_VALUE_POSITION pos_descr
#define ER_FAILED_ASSERTION
static QO_INDEX_ENTRY * is_index_compatible(QO_CLASS_INFO *class_info, int n, QO_INDEX_ENTRY *index_entry)
void qo_check_coll_optimization(QO_INDEX_ENTRY *ent, COLL_OPT *collation_opt)
static void qo_free_class_info(QO_ENV *env, QO_CLASS_INFO *)
bool pt_is_join_expr(PT_NODE *expr, UINTPTR *spec_id)
#define QO_TERM_MULTI_COLL_PRED
#define QO_NODE_PT_JOIN_TYPE(node)
#define JOIN_TYPE_EXCHANGE(e0, e1)
#define PT_SELECT_INFO_IS_FLAGED(s, f)
int sm_att_id(MOP classop, const char *name)
int bitset_is_equivalent(const BITSET *r, const BITSET *s)
static void qo_partition_dump(QO_PARTITION *, FILE *)
static void qo_subquery_free(QO_SUBQUERY *)
QO_NODE * lookup_node(PT_NODE *attr, QO_ENV *env, PT_NODE **entity)
PT_NODE * pt_function_index_skip_expr(PT_NODE *node)
bool db_value_type_is_collection(const DB_VALUE *value)
void qo_env_free(QO_ENV *env)
#define QO_ASSERT(env, cond)
static void qo_discover_edges(QO_ENV *)
void qo_get_optimization_param(void *retval, QO_PARAM param,...)
static int qo_get_ils_prefix_length(QO_ENV *env, QO_NODE *nodep, QO_INDEX_ENTRY *index_entry)
bool sm_is_index_visible(SM_CLASS_CONSTRAINT *constraint_list, BTID btid)
#define QO_ENV_LIMIT_VALUE(env)
#define qo_plan_del_ref(p)
SM_PREDICATE_INFO * filter_predicate
static int get_expr_fcode_rank(FUNC_TYPE fcode)
#define QO_TERM_INDEX_SEG(t, i)
#define QO_NI_ENTRY(ni, n)
#define QO_TERM_IS_FLAGED(t, f)
#define DETAILED_DUMP(level)
int bitset_intersects(const BITSET *r, const BITSET *s)
static void qo_discover_indexes(QO_ENV *)
void qo_eqclass_fprint_wrt(QO_EQCLASS *eqclass, BITSET *nodeset, FILE *f)
static void qo_equivalence(QO_SEGMENT *, QO_SEGMENT *)
#define db_get_collection
int bitset_iterate(const BITSET *s, BITSET_ITERATOR *si)
void qo_print_stats(FILE *f)
double qo_expr_selectivity(QO_ENV *env, PT_NODE *pt_expr)
#define QO_ENV_PARSER(env)
PT_RESERVED_NAME pt_Reserved_name_table[]
static void qo_eqclass_free(QO_EQCLASS *)
static void qo_partition_init(QO_ENV *, QO_PARTITION *, int)
#define QO_TERM_CLEAR_FLAG(t, f)
bool qo_check_type_index_covering(QO_INDEX_ENTRY *ent)
#define QO_ENV_PARTITION(env, n)
QO_PLAN * qo_optimize_query(PARSER_CONTEXT *parser, PT_NODE *tree)
bool multi_range_opt_candidate
#define QO_ON_COND_TERM(term)
static void qo_term_dump(QO_TERM *, FILE *)
PT_NODE * pt_get_select_list(PARSER_CONTEXT *parser, PT_NODE *query)
#define PT_SELECT_INFO_DISABLE_LOOSE_SCAN
static PT_NODE * get_local_subqueries_pre(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
#define QO_JOIN_INFO_SIZE(_partition)
static PT_NODE * build_query_graph_function_index(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
static PT_NODE * graph_size_select(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
#define QO_ENV_TMP_BITSET(env)
#define PT_IS_SPEC_FLAG_SET(spec_, flags_)
int bitset_is_empty(const BITSET *s)
#define assert_release(e)
static void qo_analyze_term(QO_TERM *term, int term_type)
#define QO_TERM_LOCATION(t)
#define NOMINAL_OBJECT_SIZE(class)
static QO_ATTR_INFO * qo_get_attr_info_func_index(QO_ENV *env, QO_SEGMENT *seg, const char *expr_str)
void bitset_difference(BITSET *dst, const BITSET *src)
static QO_TERM * qo_add_term(PT_NODE *conjunct, int term_type, QO_ENV *env)
#define QO_TERM_PT_EXPR(t)
static int get_operand_rank(PT_NODE *node)
static bool qo_is_usable_index(SM_CLASS_CONSTRAINT *constraint, QO_NODE *nodep)
#define QO_SEG_EQCLASS(seg)
#define SM_IS_CONSTRAINT_UNIQUE_FAMILY(c)
union pt_query_info::@124 q
#define OID_SET_NULL(oidp)
#define QO_TERM_COPY_PT_EXPR
static void qo_eqclass_add(QO_EQCLASS *, QO_SEGMENT *)
#define LOG2_SIZEOF_POINTER
void qo_term_fprint(QO_TERM *term, FILE *f)
static void qo_seg_clear(QO_ENV *, int)
SM_FUNCTION_INFO * func_index_info
bool pt_false_search_condition(PARSER_CONTEXT *parser, const PT_NODE *statement)
#define QO_NODE_INFO_N(node)
DB_DOMAIN * pt_node_to_db_domain(PARSER_CONTEXT *parser, PT_NODE *node, const char *class_name)
#define QO_NODE_HINT(node)
#define QO_IS_EDGE_TERM(t)
struct sm_class_constraint * next
#define BTID_IS_EQUAL(b1, b2)
SM_CLASS_CONSTRAINT * constraints
#define DOUBLE_EXCHANGE(e0, e1)
#define QO_TERM_MULTI_COLL_CONST
struct qo_eqclass QO_EQCLASS
const char * qo_plan_set_cost_fn(const char *, int)
#define INT_EXCHANGE(e0, e1)
static void qo_term_clear(QO_ENV *, int)
HFID * sm_get_ch_heap(MOP classmop)
static PT_NODE * set_seg_expr(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
#define QO_NODE_INFO(node)
void prm_set_integer_value(PARAM_ID prm_id, int value)
static void qo_free_attr_info(QO_ENV *env, QO_ATTR_INFO *info)
static bool qo_is_pk_fk_full_join(QO_ENV *env, QO_NODE *fk_node, QO_NODE *pk_node)
#define QO_EQCLASS_IDX(e)
#define QO_SEG_EQ_ROOT(seg)
unsigned single_table_opt
#define PT_IS_OID_NAME(n)
#define QO_NODE_REL_IDX(node)
#define QO_SEG_INDEX_TERMS(seg)
#define SIZEOF_NODE_INDEX(n)
bool all_unique_index_columns_are_equi_terms
SM_CLASS_CONSTRAINT * sm_class_constraints(MOP classop)
static bool qo_is_non_mvcc_class_with_index(QO_CLASS_INFO_ENTRY *class_entry_p)
#define PT_NODE_EXCHANGE(e0, e1)
#define QO_PARTITION_PLAN(p)
static PT_NODE * build_query_graph(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
#define QO_NODE_DEP_SET(node)
PT_JSON_TABLE_INFO json_table_info
#define QO_PARTITION_IDX(p)
PT_PRINT_VALUE_FUNC print_db_value
#define QO_NODE_NCARD(node)
static DB_OBJECT * is_class(OID *obj_oid, OID *class_oid)
DB_TYPE pt_type_enum_to_db(const PT_TYPE_ENUM t)
#define SIZEOF_ATTR_CUM_STATS_PKEYS(n)
#define QO_PARTITION_M_OFFSET(p)
static void graph_size_for_entity(QO_ENV *env, PT_NODE *entity)
static void qo_exchange(QO_TERM *t0, QO_TERM *t1)
char * parser_print_function_index_expr(PARSER_CONTEXT *parser, const PT_NODE *expr)
#define NODEPTR_EXCHANGE(e0, e1)
static QO_NODE * build_graph_for_entity(QO_ENV *env, PT_NODE *entity, QO_BUILD_STATUS status)
PT_MISC_TYPE derived_table_type
static PT_NODE * qo_add_final_segment(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
PT_OP_TYPE pt_converse_op(PT_OP_TYPE op)
#define QO_TERM_MULTI_COL_SEGS(t)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int bitset_subset(const BITSET *r, const BITSET *s)
LANG_COLLATION * lang_get_collation(const int coll_id)
#define QO_INDEX_INDEX(ind, n)
PT_FUNCTION_INFO function
#define QO_NODE_RIGHT_DEP_SET(node)
static void qo_node_free(QO_NODE *)
void qo_termset_fprint(QO_ENV *env, BITSET *terms, FILE *f)
static void swap_node(T_LIST *node1, T_LIST *node2)
void bitset_print(const BITSET *s, FILE *fp)
#define QO_EQCLASS_ENV(e)
QO_SEGMENT * lookup_seg(QO_NODE *head, PT_NODE *name, QO_ENV *env)
void bitset_delset(BITSET *s)
PT_NODE * parser_walk_leaves(PARSER_CONTEXT *parser, PT_NODE *node, PT_NODE_WALK_FUNCTION pre_function, void *pre_argument, PT_NODE_WALK_FUNCTION post_function, void *post_argument)
static void qo_add_dep_term(QO_NODE *derived_node, BITSET *depend_nodes, BITSET *depend_segs, QO_ENV *env)
#define SEGMENTPTR_EXCHANGE(e0, e1)
void bitset_assign(BITSET *dst, const BITSET *src)
int * attrs_prefix_length
#define QO_NODE_ENV(node)
#define QO_TERM_SINGLE_PRED
int prm_get_integer_value(PARAM_ID prm_id)
int pt_get_query_limit_value(PARSER_CONTEXT *parser, PT_NODE *query, DB_VALUE *limit_val)
static void set_seg_node(PT_NODE *attr, QO_ENV *env, BITSET *bitset)
static void add_using_index(QO_ENV *env, PT_NODE *using_index)
static void add_hint(QO_ENV *env, PT_NODE *tree)
#define PT_IS_CLASSOID_NAME(x)
void bitset_union(BITSET *dst, const BITSET *src)
#define ER_OUT_OF_VIRTUAL_MEMORY
static QO_SEGMENT * qo_eqclass_wrt(QO_EQCLASS *, BITSET *)
#define QO_NODE_USING_INDEX(node)
bool pt_is_pseudo_const(PT_NODE *expr)
#define NOMINAL_HEAP_SIZE(class)
static void qo_term_free(QO_TERM *)
QO_SEGMENT * index_seg[2]
static void qo_discover_sort_limit_join_nodes(QO_ENV *env, QO_NODE *nodep, BITSET *order_nodes, BITSET *dep_nodes)
static void qo_free_index(QO_ENV *env, QO_INDEX *)
PT_NODE * flat_entity_list
static int is_equivalent_indexes(QO_INDEX_ENTRY *index1, QO_INDEX_ENTRY *index2)
void qo_plans_stats(FILE *f)
#define QO_NODE_SARGABLE(node)
PT_MISC_TYPE all_distinct
bool pt_has_analytic(PARSER_CONTEXT *parser, PT_NODE *node)
static void qo_seg_free(QO_SEGMENT *)
#define QO_UI_FORCE(ui, n)
int intl_identifier_casecmp(const char *str1, const char *str2)
static void qo_find_index_seg_terms(QO_ENV *env, QO_INDEX_ENTRY *index_entry, int idx, BITSET *index_segsp)
static void qo_eqclass_dump(QO_EQCLASS *, FILE *)
#define BTREE_STATS_PKEYS_NUM
static bool is_local_name(QO_ENV *env, PT_NODE *expr)
#define QO_SEG_SHARED_ATTR(seg)
struct qo_segment QO_SEGMENT
#define TP_DOMAIN_COLLATION(dom)
int qo_seg_width(QO_SEGMENT *seg)
#define QO_TERM_NOMINAL_SEG(t)
#define OPTIMIZATION_ENABLED(level)
#define QO_NODE_SUBQUERIES(node)
FILE * query_Plan_dump_fp
const char * sm_get_ch_name(MOP op)
#define PT_SELECT_INFO_HAS_AGG
static bool qo_is_coverage_index(QO_ENV *env, QO_NODE *nodep, QO_INDEX_ENTRY *index_entry)
#define PT_SELECT_INFO_COLS_SCHEMA
static int qo_find_matching_index(QO_INDEX_ENTRY *index_entry, QO_INDEX *class_indexes)
static void qo_discover_partitions(QO_ENV *)
static void qo_assign_eq_classes(QO_ENV *)
BITSET multi_col_range_segs
void qo_set_optimization_param(void *retval, QO_PARAM param,...)
static void qo_classify_outerjoin_terms(QO_ENV *)
#define TP_DOMAIN_TYPE(dom)
void qo_expr_segs(QO_ENV *env, PT_NODE *pt_expr, BITSET *result)
#define QO_IS_DEP_TERM(t)
static void cleanup(int signo)
#define QO_TERM_MULTI_COL_CNT(t)
PT_NODE * pt_find_entity(PARSER_CONTEXT *parser, const PT_NODE *scope, UINTPTR id)
static void qo_subquery_dump(QO_ENV *, QO_SUBQUERY *, FILE *)
static int get_opcode_rank(PT_OP_TYPE opcode)
PT_NODE * referenced_attrs
#define QO_NODE_SARGS(node)
#define RANK_EXPR_FUNCTION
#define PT_SPEC_IS_DERIVED(spec_)
DB_TIMESTAMPTZ timestamptz
#define QO_ADD_RIGHT_TO_OUTER(tail, head)
#define QO_EQCLASS_TERM(e)
char * pt_append_string(const PARSER_CONTEXT *parser, const char *old_string, const char *new_tail)
#define QO_SEG_FUNC_INDEX(seg)
#define pt_is_multi_col_term(n)
#define SM_IS_CONSTRAINT_INDEX_FAMILY(c)
TP_DOMAIN * tp_domain_cache(TP_DOMAIN *transient)
#define PT_EXPR_INFO_TRANSITIVE
static bool qo_is_iss_index(QO_ENV *env, QO_NODE *nodep, QO_INDEX_ENTRY *index_entry)
#define QO_SEG_PT_NODE(seg)
#define QO_TERM_MERGEABLE_EDGE
#define PT_SPEC_IS_CTE(spec_)
PT_NODE * pt_continue_walk(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
static QO_SEGMENT * qo_join_segment(QO_NODE *head, QO_NODE *tail, PT_NODE *name, QO_ENV *env)
static bool qo_validate(QO_ENV *env)
static PT_NODE * get_local_subqueries_post(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
static void qo_estimate_statistics(MOP class_mop, CLASS_STATS *)
#define QO_TERM_CAN_USE_INDEX(t)
bool pt_has_aggregate(PARSER_CONTEXT *parser, PT_NODE *node)
void qo_seg_fprint(QO_SEGMENT *seg, FILE *f)
static QO_ATTR_INFO * qo_get_attr_info(QO_ENV *env, QO_SEGMENT *seg)
static QO_ENV * qo_env_init(PARSER_CONTEXT *parser, PT_NODE *query)
int db_col_size(DB_COLLECTION *col)
#define QO_ADD_RIGHT_DEP_SET(tail, head)
int pr_clear_value(DB_VALUE *value)
#define QO_SEG_CLASS_ATTR(seg)
DB_BIGINT db_get_bigint(const DB_VALUE *value)
#define QO_NODE_SELECTIVITY(node)
#define QO_SEG_IS_OID_SEG(seg)
#define QO_ADD_OUTER_DEP_SET(tail, head)
PT_NODE * pt_has_non_idx_sarg_coll_pre(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
PT_NODE * pt_check_instnum_pre(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
int bitset_next_member(BITSET_ITERATOR *si)
#define QO_ENV_SORT_LIMIT_NODES(env)
DB_TYPE sm_att_type_id(MOP classop, const char *name)
void bitset_remove(BITSET *dst, int x)
SM_CLASS_CONSTRAINT * constraints
int pt_is_function_index_expression(PT_NODE *node)
#define QO_NODE_EQCLASSES(node)
bool qo_need_skip_execution(void)
PT_NODE * parser_new_node(PARSER_CONTEXT *parser, PT_NODE_TYPE node_type)
static void error(const char *msg)
#define QO_ENTRY_MULTI_COL(entry)
unsigned is_system_generated_stmt
#define QO_TERM_OID_SEG(t)
static void qo_get_index_info(QO_ENV *env, QO_NODE *node)
static void qo_discover_sort_limit_nodes(QO_ENV *env)
#define TERMCLASS_EXCHANGE(e0, e1)
SM_CLASS_CONSTRAINT * classobj_find_class_index(SM_CLASS *class_, const char *name)
static PT_NODE * build_query_graph_post(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
#define QO_NODE_TCARD(node)
#define TP_TYPE_HAS_COLLATION(typeid)
static bool is_dependent_table(PT_NODE *entity)
#define HFID_IS_NULL(hfid)
static void qo_find_index_terms(QO_ENV *env, BITSET *segsp, QO_INDEX_ENTRY *index_entry)
PT_SORT_SPEC_INFO sort_spec
static QO_PLAN * qo_optimize_helper(QO_ENV *env)
bool qo_is_prefix_index(QO_INDEX_ENTRY *ent)
#define SIZEOF_CLASS_INFO(n)
#define OPTIMIZATION_LIMIT
#define QO_TERM_SELECTIVITY(t)
#define QO_UI_INDEX(ui, n)
bool pt_name_equal(PARSER_CONTEXT *parser, const PT_NODE *name1, const PT_NODE *name2)
void parser_free_tree(PARSER_CONTEXT *parser, PT_NODE *tree)
#define QO_TERM_NON_IDX_SARG_COLL
#define QO_NODE_PARTITION(node)
static QO_NODE * qo_add_node(PT_NODE *entity, QO_ENV *env)
static PT_NODE * get_referenced_attrs(PT_NODE *entity)
static void get_term_rank(QO_ENV *env, QO_TERM *term)
#define QO_UI_KEYLIMIT(ui, n)
static void get_rank(QO_ENV *env)
#define QO_NODE_LOCATION(node)
#define QO_TERM_RANGELIST
struct qo_index_entry * next
struct qo_partition QO_PARTITION
#define QO_IS_FAKE_TERM(t)
#define free_and_init(ptr)
#define BITSET_MEMBER(s, x)
QO_PLAN * qo_planner_search(QO_ENV *env)
QO_ATTR_CUM_STATS cum_stats
bool pt_is_function_index_expr(PARSER_CONTEXT *parser, PT_NODE *expr, bool report_error)
#define PT_SELECT_FULL_INFO_COLS_SCHEMA
static int count_classes(PT_NODE *p)
static void get_local_subqueries(QO_ENV *env, PT_NODE *tree)
QO_SORT_LIMIT_USE use_sort_limit
#define BITSET_MOVE(dst, src)
#define QO_GET_CLASS_STATS(entryp)
bool prm_get_bool_value(PARAM_ID prm_id)
#define QO_TERM_EQCLASS(t)
SM_ATTRIBUTE ** attributes
void qo_abort(QO_ENV *env, const char *file, int line)
int pt_is_attr(PT_NODE *node)
int pt_is_single_tuple(PARSER_CONTEXT *parser, PT_NODE *select_node)
PT_NODE * after_cb_filter
#define QO_NODE_NAME(node)
PARSER_VARCHAR * pt_print_node_value(PARSER_CONTEXT *parser, const PT_NODE *val)
static bool qo_is_equi_join_term(QO_TERM *term)
int qo_plan_get_cost_fn(const char *)
static void get_term_subqueries(QO_ENV *env, QO_TERM *term)
#define QO_ENV_NODE(env, n)
SM_CLASS * sm_get_class_with_statistics(MOP classop)
static QO_SEGMENT * qo_insert_segment(QO_NODE *head, QO_NODE *tail, PT_NODE *node, QO_ENV *env, const char *expr_str)
#define QO_ENV_EQCLASS(env, n)
#define QO_ENV_TERM(env, n)
static int qo_data_compare(DB_DATA *data1, DB_DATA *data2, DB_TYPE type)
char * parser_print_tree(PARSER_CONTEXT *parser, const PT_NODE *node)
#define QO_ENV_SEG(env, n)
#define PUT_FLAG(cond, flag)
int db_make_null(DB_VALUE *value)
#define QO_OUTER_JOIN_TERM(term)
bool oid_check_cached_class_oid(const int cache_id, const OID *oid)
#define QO_TERM_SET_FLAG(t, f)
#define DB_IS_NULL(value)
static void qo_find_node_indexes(QO_ENV *, QO_NODE *)
#define QO_PARTITION_DEPENDENCIES(p)
PARSER_VARCHAR *(* PT_PRINT_VALUE_FUNC)(PARSER_CONTEXT *parser, const PT_NODE *val)
#define pt_is_set_type(n)
void bitset_init(BITSET *s, QO_ENV *env)
char * statistics_attribute_name
#define PT_SPEC_SPECIAL_INDEX_SCAN(spec_)
static void qo_seg_nodes(QO_ENV *, BITSET *, BITSET *)
char * strdup(const char *str)
static void add_hint_args(QO_ENV *env, PT_NODE *arg_list, PT_HINT_ENUM hint)
SM_INDEX_STATUS index_status
#define QO_NODE_IDX(node)
static QO_EQCLASS * qo_eqclass_new(QO_ENV *)
static PT_NODE * check_subquery_pre(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
int bitset_cardinality(const BITSET *s)
#define PT_INTERNAL_ERROR(parser, what)
#define BISET_EXCHANGE(s0, s1)
bool qo_is_filter_index(QO_INDEX_ENTRY *ent)
#define QO_NODE_OID_SEG(node)
#define QO_ENV_PT_TREE(env)
MOP sm_find_class(const char *name)
QO_CLASS_INFO_ENTRY info[1]
#define QO_NODE_ENTITY_SPEC(node)
#define QO_PARTITION_NODES(p)
static void qo_env_dump(QO_ENV *, FILE *)
static QO_ENV * qo_env_new(PARSER_CONTEXT *, PT_NODE *)
int bitset_first_member(const BITSET *s)
#define TP_TYPE_NOT_SUPPORT_COVERING(typeid)
static QO_TERM * qo_add_dummy_join_term(QO_ENV *env, QO_NODE *p_node, QO_NODE *on_node)
#define QO_NODE_INDEXES(node)
#define QO_NODE_OUTER_DEP_SET(node)
void qo_planner_free(QO_PLANNER *planner)
#define QO_NODE_SEGS(node)
#define EQCLASSPTR_EXCHANGE(e0, e1)
void bitset_add(BITSET *dst, int x)
struct parser_node::@132 flag
#define QO_NODE_SORT_LIMIT_CANDIDATE(node)
#define QO_NODE_IS_OUTER_JOIN(node)
#define PLAN_DUMP_ENABLED(level)
void qo_node_fprint(QO_NODE *node, FILE *f)
PT_NODE * parser_walk_tree(PARSER_CONTEXT *parser, PT_NODE *node, PT_NODE_WALK_FUNCTION pre_function, void *pre_argument, PT_NODE_WALK_FUNCTION post_function, void *post_argument)
#define PT_EXPR_INFO_IS_FLAGED(e, f)
#define QO_PARTITION_EDGES(p)
static bool qo_find_index_segs(QO_ENV *, SM_CLASS_CONSTRAINT *, QO_NODE *, int *, int, int *, BITSET *)
static QO_INDEX * qo_alloc_index(QO_ENV *env, int)
PT_NODE * pt_check_instnum_post(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
#define QO_SEG_SET_VALUED(seg)
static QO_CLASS_INFO_ENTRY * grok_classes(QO_ENV *env, PT_NODE *dom_set, QO_CLASS_INFO_ENTRY *info)
static void add_local_subquery(QO_ENV *env, PT_NODE *node)
#define SIZEOF_USING_INDEX(n)
#define QO_TERM_JOIN_TYPE(t)
static void qo_node_clear(QO_ENV *, int)
#define FLAG_EXCHANGE(e0, e1)
static QO_CLASS_INFO * qo_get_class_info(QO_ENV *env, QO_NODE *node)
#define QO_EQCLASS_SEGS(e)
static void qo_free_node_index_info(QO_ENV *env, QO_NODE_INDEX *node_indexp)
#define INT_PTR_EXCHANGE(e0, e1)
static void qo_node_add_sarg(QO_NODE *, QO_TERM *)
void qo_info_stats(FILE *f)