Skip to content

File optimizer.h

FileList > cubrid > src > optimizer > optimizer.h

Go to the source code of this file

  • #include <stdarg.h>
  • #include <assert.h>
  • #include "error_manager.h"
  • #include "memory_alloc.h"
  • #include "parser.h"
  • #include "query_bitset.h"
  • #include "release_string.h"

Classes

Type Name
struct QO_ATTR_CUM_STATS
struct projection_final_info
struct projection_info
struct projection_part_info
struct qo_limit_info
struct qo_summary

Public Types

Type Name
typedef struct projection_final_info PROJECTION_FINAL_INFO
typedef struct projection_info PROJECTION_INFO
typedef struct projection_part_info PROJECTION_PART_INFO
typedef struct qo_attr_info QO_ATTR_INFO
typedef struct qo_class_info QO_CLASS_INFO
typedef struct qo_env QO_ENV
typedef struct qo_eqclass QO_EQCLASS
typedef struct qo_index QO_INDEX
typedef struct qo_index_entry QO_INDEX_ENTRY
typedef struct qo_index_xasl_info QO_INDEX_XASL_INFO
typedef struct qo_info QO_INFO
typedef struct qo_limit_info QO_LIMIT_INFO
typedef struct qo_node QO_NODE
typedef struct qo_node_index QO_NODE_INDEX
typedef struct qo_node_index_entry QO_NODE_INDEX_ENTRY
enum QO_PARAM
typedef struct qo_partition QO_PARTITION
typedef struct qo_plan QO_PLAN
typedef struct qo_planner QO_PLANNER
typedef struct qo_segment QO_SEGMENT
typedef struct qo_subquery QO_SUBQUERY
typedef struct qo_summary QO_SUMMARY
typedef struct qo_term QO_TERM
typedef struct qo_using_index QO_USING_INDEX
typedef struct qo_using_index_entry QO_USING_INDEX_ENTRY
typedef struct qo_xasl_index_info QO_XASL_INDEX_INFO

Public Functions

Type Name
QO_NODE * lookup_node (PT_NODE * attr, QO_ENV * env, PT_NODE ** entity)
QO_SEGMENT * lookup_seg (QO_NODE * head, PT_NODE * name, QO_ENV * env)
PT_NODE * mq_rewrite (PARSER_CONTEXT * parser, PT_NODE * statement)
void qo_abort (QO_ENV * env, const char * file, int line)
xasl_node * qo_add_hq_iterations_access_spec (QO_PLAN * plan, xasl_node * xasl)
bool qo_check_iscan_for_multi_range_opt (QO_PLAN * plan)
bool qo_check_join_for_multi_range_opt (QO_PLAN * plan)
PT_NODE * qo_check_nullable_expr (PARSER_CONTEXT * parser, PT_NODE * node, void * arg, int * continue_walk)
void qo_expr_segs (QO_ENV * env, PT_NODE * pt_expr, BITSET * result)
double qo_expr_selectivity (QO_ENV * env, PT_NODE * pt_expr)
int qo_find_subplan_using_multi_range_opt (QO_PLAN * plan, QO_PLAN ** result, int * join_idx)
QO_LIMIT_INFO * qo_get_key_limit_from_instnum (PARSER_CONTEXT * parser, QO_PLAN * plan, xasl_node * xasl)
QO_LIMIT_INFO * qo_get_key_limit_from_ordbynum (PARSER_CONTEXT * parser, QO_PLAN * plan, xasl_node * xasl, bool ignore_lower)
void qo_get_optimization_param (void * retval, QO_PARAM param, ...)
bool qo_is_index_covering_scan (QO_PLAN * plan)
bool qo_is_index_iss_scan (QO_PLAN * plan)
bool qo_is_index_loose_scan (QO_PLAN * plan)
bool qo_is_index_mro_scan (QO_PLAN * plan)
bool qo_need_skip_execution (void)
QO_PLAN * qo_optimize_query (PARSER_CONTEXT * parser, PT_NODE * tree)
void qo_plan_discard (QO_PLAN * plan)
void qo_plan_dump (QO_PLAN * plan, FILE * output)
int qo_plan_get_cost_fn (const char * plan_name)
PT_NODE * qo_plan_iscan_sort_list (QO_PLAN * plan)
bool qo_plan_multi_range_opt (QO_PLAN * plan)
const char * qo_plan_set_cost_fn (const char * plan_name, int fn)
bool qo_plan_skip_groupby (QO_PLAN * plan)
bool qo_plan_skip_orderby (QO_PLAN * plan)
void qo_set_optimization_param (void * retval, QO_PARAM param, ...)
xasl_node * qo_to_xasl (QO_PLAN * plan, xasl_node * xasl)
void qo_top_plan_print_json (PARSER_CONTEXT * parser, xasl_node * xasl, PT_NODE * select, QO_PLAN * plan)
void qo_top_plan_print_text (PARSER_CONTEXT * parser, xasl_node * xasl, PT_NODE * select, QO_PLAN * plan)
int qo_xasl_get_num_terms (QO_XASL_INDEX_INFO * info)
PT_NODE ** qo_xasl_get_terms (QO_XASL_INDEX_INFO * info)

Macros

Type Name
define CHECK_INVALID_OPTIMIZATION_LEVEL (level) (!([**CHECK\_VALID\_EXECUTION**](optimizer_8h.md#define-check_valid_execution)(level) && [**CHECK\_VALID\_PLAN**](optimizer_8h.md#define-check_valid_plan)(level)))
define CHECK_VALID_EXECUTION (level) ((level & 0x00ff) &gt; 0 && (level & 0x00ff) &lt; 3)
define CHECK_VALID_PLAN (level) (((level&gt;&gt;8) & 0x00ff) &gt;= 0 && ((level&gt;&gt;8) & 0x00ff) &lt; 3)
define DETAILED_DUMP (level) ((level) & 0x200)
define OPTIMIZATION_ENABLED (level) ([**OPT\_LEVEL**](optimizer_8h.md#define-opt_level)(level) != 0)
define OPT_LEVEL (level) ((level) & 0xff)
define PLAN_DUMP_ENABLED (level) ((level) &gt;= 0x100)
define PROJECTION_FINAL_INFO_INITIALIZER { [**NULL**](freelistheap_8h.md#define-null), 0 }
define PROJECTION_INFO_INITIALIZER { [**PROJECTION\_PART\_INFO\_INITIALIZER**](optimizer_8h.md#define-projection_part_info_initializer), [**PROJECTION\_PART\_INFO\_INITIALIZER**](optimizer_8h.md#define-projection_part_info_initializer), [**PROJECTION\_FINAL\_INFO\_INITIALIZER**](optimizer_8h.md#define-projection_final_info_initializer) }
define PROJECTION_PART_INFO_INITIALIZER { [**NULL**](freelistheap_8h.md#define-null), [**NULL**](freelistheap_8h.md#define-null), [**NULL**](freelistheap_8h.md#define-null), [**NULL**](freelistheap_8h.md#define-null), [**EMPTY\_SET**](query__bitset_8c.md#variable-empty_set), 0, 0, 0, 0, [**NULL**](freelistheap_8h.md#define-null)}
define QO_ABORT (env) [**qo\_abort**](optimizer_8h.md#function-qo_abort)((env), [**\_\_FILE\_\_**](broker__monitor_8c.md#function-timeout), [**\_\_LINE\_\_**](broker__monitor_8c.md#function-timeout))
define QO_ASSERT (env, cond) /* multi line expression */
define QO_ERROR (code)
define QO_ERROR1 (code, x)
define QO_ERROR2 (code, x, y)
define QO_WARN (code)
define QO_WARN1 (code, x)
define SIMPLE_DUMP (level) ((level) & 0x100)
define UNEXPECTED_CASE 0
define UNREACHABLE 0

Public Types Documentation

typedef PROJECTION_FINAL_INFO

typedef struct projection_final_info PROJECTION_FINAL_INFO;

typedef PROJECTION_INFO

typedef struct projection_info PROJECTION_INFO;

typedef PROJECTION_PART_INFO

typedef struct projection_part_info PROJECTION_PART_INFO;

typedef QO_ATTR_INFO

typedef struct qo_attr_info QO_ATTR_INFO;

typedef QO_CLASS_INFO

typedef struct qo_class_info QO_CLASS_INFO;

typedef QO_ENV

typedef struct qo_env QO_ENV;

typedef QO_EQCLASS

typedef struct qo_eqclass QO_EQCLASS;

typedef QO_INDEX

typedef struct qo_index QO_INDEX;

typedef QO_INDEX_ENTRY

typedef struct qo_index_entry QO_INDEX_ENTRY;

typedef QO_INDEX_XASL_INFO

typedef struct qo_index_xasl_info QO_INDEX_XASL_INFO;

typedef QO_INFO

typedef struct qo_info QO_INFO;

typedef QO_LIMIT_INFO

typedef struct qo_limit_info QO_LIMIT_INFO;

typedef QO_NODE

typedef struct qo_node QO_NODE;

typedef QO_NODE_INDEX

typedef struct qo_node_index QO_NODE_INDEX;

typedef QO_NODE_INDEX_ENTRY

typedef struct qo_node_index_entry QO_NODE_INDEX_ENTRY;

enum QO_PARAM

enum QO_PARAM {
    QO_PARAM_LEVEL,
    QO_PARAM_COST
};

typedef QO_PARTITION

typedef struct qo_partition QO_PARTITION;

typedef QO_PLAN

typedef struct qo_plan QO_PLAN;

typedef QO_PLANNER

typedef struct qo_planner QO_PLANNER;

typedef QO_SEGMENT

typedef struct qo_segment QO_SEGMENT;

typedef QO_SUBQUERY

typedef struct qo_subquery QO_SUBQUERY;

typedef QO_SUMMARY

typedef struct qo_summary QO_SUMMARY;

typedef QO_TERM

typedef struct qo_term QO_TERM;

typedef QO_USING_INDEX

typedef struct qo_using_index QO_USING_INDEX;

typedef QO_USING_INDEX_ENTRY

typedef struct qo_using_index_entry QO_USING_INDEX_ENTRY;

typedef QO_XASL_INDEX_INFO

typedef struct qo_xasl_index_info QO_XASL_INDEX_INFO;

Public Functions Documentation

function lookup_node

QO_NODE * lookup_node (
    PT_NODE * attr,
    QO_ENV * env,
    PT_NODE ** entity
) 

function lookup_seg

QO_SEGMENT * lookup_seg (
    QO_NODE * head,
    PT_NODE * name,
    QO_ENV * env
) 

function mq_rewrite

PT_NODE * mq_rewrite (
    PARSER_CONTEXT * parser,
    PT_NODE * statement
) 

function qo_abort

void qo_abort (
    QO_ENV * env,
    const  char * file,
    int line
) 

function qo_add_hq_iterations_access_spec

xasl_node * qo_add_hq_iterations_access_spec (
    QO_PLAN * plan,
    xasl_node * xasl
) 

function qo_check_iscan_for_multi_range_opt

bool qo_check_iscan_for_multi_range_opt (
    QO_PLAN * plan
) 

function qo_check_join_for_multi_range_opt

bool qo_check_join_for_multi_range_opt (
    QO_PLAN * plan
) 

function qo_check_nullable_expr

PT_NODE * qo_check_nullable_expr (
    PARSER_CONTEXT * parser,
    PT_NODE * node,
    void * arg,
    int * continue_walk
) 

function qo_expr_segs

void qo_expr_segs (
    QO_ENV * env,
    PT_NODE * pt_expr,
    BITSET * result
) 

function qo_expr_selectivity

double qo_expr_selectivity (
    QO_ENV * env,
    PT_NODE * pt_expr
) 

function qo_find_subplan_using_multi_range_opt

int qo_find_subplan_using_multi_range_opt (
    QO_PLAN * plan,
    QO_PLAN ** result,
    int * join_idx
) 

function qo_get_key_limit_from_instnum

QO_LIMIT_INFO * qo_get_key_limit_from_instnum (
    PARSER_CONTEXT * parser,
    QO_PLAN * plan,
    xasl_node * xasl
) 

function qo_get_key_limit_from_ordbynum

QO_LIMIT_INFO * qo_get_key_limit_from_ordbynum (
    PARSER_CONTEXT * parser,
    QO_PLAN * plan,
    xasl_node * xasl,
    bool ignore_lower
) 

function qo_get_optimization_param

void qo_get_optimization_param (
    void * retval,
    QO_PARAM param,
    ...
) 

function qo_is_index_covering_scan

bool qo_is_index_covering_scan (
    QO_PLAN * plan
) 

function qo_is_index_iss_scan

bool qo_is_index_iss_scan (
    QO_PLAN * plan
) 

function qo_is_index_loose_scan

bool qo_is_index_loose_scan (
    QO_PLAN * plan
) 

function qo_is_index_mro_scan

bool qo_is_index_mro_scan (
    QO_PLAN * plan
) 

function qo_need_skip_execution

bool qo_need_skip_execution (
    void
) 

function qo_optimize_query

QO_PLAN * qo_optimize_query (
    PARSER_CONTEXT * parser,
    PT_NODE * tree
) 

function qo_plan_discard

void qo_plan_discard (
    QO_PLAN * plan
) 

function qo_plan_dump

void qo_plan_dump (
    QO_PLAN * plan,
    FILE * output
) 

function qo_plan_get_cost_fn

int qo_plan_get_cost_fn (
    const  char * plan_name
) 

function qo_plan_iscan_sort_list

PT_NODE * qo_plan_iscan_sort_list (
    QO_PLAN * plan
) 

function qo_plan_multi_range_opt

bool qo_plan_multi_range_opt (
    QO_PLAN * plan
) 

function qo_plan_set_cost_fn

const  char * qo_plan_set_cost_fn (
    const  char * plan_name,
    int fn
) 

function qo_plan_skip_groupby

bool qo_plan_skip_groupby (
    QO_PLAN * plan
) 

function qo_plan_skip_orderby

bool qo_plan_skip_orderby (
    QO_PLAN * plan
) 

function qo_set_optimization_param

void qo_set_optimization_param (
    void * retval,
    QO_PARAM param,
    ...
) 

function qo_to_xasl

xasl_node * qo_to_xasl (
    QO_PLAN * plan,
    xasl_node * xasl
) 

function qo_top_plan_print_json

void qo_top_plan_print_json (
    PARSER_CONTEXT * parser,
    xasl_node * xasl,
    PT_NODE * select,
    QO_PLAN * plan
) 

function qo_top_plan_print_text

void qo_top_plan_print_text (
    PARSER_CONTEXT * parser,
    xasl_node * xasl,
    PT_NODE * select,
    QO_PLAN * plan
) 

function qo_xasl_get_num_terms

int qo_xasl_get_num_terms (
    QO_XASL_INDEX_INFO * info
) 

function qo_xasl_get_terms

PT_NODE ** qo_xasl_get_terms (
    QO_XASL_INDEX_INFO * info
) 

Macro Definition Documentation

define CHECK_INVALID_OPTIMIZATION_LEVEL

#define CHECK_INVALID_OPTIMIZATION_LEVEL (
    level
) `(!( CHECK_VALID_EXECUTION (level) && CHECK_VALID_PLAN (level)))`

define CHECK_VALID_EXECUTION

#define CHECK_VALID_EXECUTION (
    level
) `((level & 0x00ff) > 0 && (level & 0x00ff) < 3)`

define CHECK_VALID_PLAN

#define CHECK_VALID_PLAN (
    level
) `(((level>>8) & 0x00ff) >= 0 && ((level>>8) & 0x00ff) < 3)`

define DETAILED_DUMP

#define DETAILED_DUMP (
    level
) `((level) & 0x200)`

define OPTIMIZATION_ENABLED

#define OPTIMIZATION_ENABLED (
    level
) `( OPT_LEVEL (level) != 0)`

define OPT_LEVEL

#define OPT_LEVEL (
    level
) `((level) & 0xff)`

define PLAN_DUMP_ENABLED

#define PLAN_DUMP_ENABLED (
    level
) `((level) >= 0x100)`

define PROJECTION_FINAL_INFO_INITIALIZER

#define PROJECTION_FINAL_INFO_INITIALIZER `{ NULL , 0 }`

define PROJECTION_INFO_INITIALIZER

#define PROJECTION_INFO_INITIALIZER `{ PROJECTION_PART_INFO_INITIALIZER , PROJECTION_PART_INFO_INITIALIZER , PROJECTION_FINAL_INFO_INITIALIZER }`

define PROJECTION_PART_INFO_INITIALIZER

#define PROJECTION_PART_INFO_INITIALIZER `{ NULL , NULL , NULL , NULL , EMPTY_SET , 0, 0, 0, 0, NULL }`

define QO_ABORT

#define QO_ABORT (
    env
) `qo_abort ((env), __FILE__ , __LINE__ )`

define QO_ASSERT

#define QO_ASSERT (
    env,
    cond
) `/* multi line expression */`

define QO_ERROR

#define QO_ERROR (
    code
) 

define QO_ERROR1

#define QO_ERROR1 (
    code,
    x
) 

define QO_ERROR2

#define QO_ERROR2 (
    code,
    x,
    y
) 

define QO_WARN

#define QO_WARN (
    code
) 

define QO_WARN1

#define QO_WARN1 (
    code,
    x
) 

define SIMPLE_DUMP

#define SIMPLE_DUMP (
    level
) `((level) & 0x100)`

define UNEXPECTED_CASE

#define UNEXPECTED_CASE `0`

define UNREACHABLE

#define UNREACHABLE `0`


The documentation for this class was generated from the following file cubrid/src/optimizer/optimizer.h