aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/QueryPlan/Optimizations/QueryPlanOptimizationSettings.h
blob: d98c34ce2264f30a225c32164a88463908e8dfa1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include <Interpreters/Context_fwd.h>

#include <cstddef>

namespace DB
{

struct Settings;

struct QueryPlanOptimizationSettings
{
    /// If not zero, throw if too many optimizations were applied to query plan.
    /// It helps to avoid infinite optimization loop.
    size_t max_optimizations_to_apply = 0;

    /// If disabled, no optimization applied.
    bool optimize_plan = true;

    /// If filter push down optimization is enabled.
    bool filter_push_down = true;

    /// if distinct in order optimization is enabled
    bool distinct_in_order = false;

    /// If read-in-order optimisation is enabled
    bool read_in_order = true;

    /// If aggregation-in-order optimisation is enabled
    bool aggregation_in_order = false;

    /// If removing redundant sorting is enabled, for example, ORDER BY clauses in subqueries
    bool remove_redundant_sorting = true;

    bool aggregate_partitions_independently = false;

    /// If removing redundant distinct steps is enabled
    bool remove_redundant_distinct = true;

    /// If reading from projection can be applied
    bool optimize_projection = false;
    bool force_use_projection = false;
    bool optimize_use_implicit_projections = false;

    static QueryPlanOptimizationSettings fromSettings(const Settings & from);
    static QueryPlanOptimizationSettings fromContext(ContextPtr from);
};

}