1 21 22 package org.apache.derby.iapi.sql.compile; 23 24 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 25 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 26 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor; 27 28 import org.apache.derby.iapi.error.StandardException; 29 30 import org.apache.derby.iapi.util.JBitSet; 31 32 39 40 public interface Optimizer { 41 44 String MODULE = "org.apache.derby.iapi.sql.compile.Optimizer"; 45 46 49 String JOIN_ORDER_OPTIMIZATION = "derby.optimizer.optimizeJoinOrder"; 50 51 55 String RULE_BASED_OPTIMIZATION = 56 "derby.optimizer.ruleBasedOptimization"; 57 58 62 String NO_TIMEOUT = "derby.optimizer.noTimeout"; 63 64 70 String MAX_MEMORY_PER_TABLE = "derby.language.maxMemoryPerTable"; 71 72 76 int MAX_DYNAMIC_MATERIALIZED_ROWS = 512; 77 78 81 String USE_STATISTICS = "derby.language.useStatistics"; 82 83 84 int NORMAL_PLAN = 1; 85 86 87 int SORT_AVOIDANCE_PLAN = 2; 88 89 public static final int STARTED = 1; 91 public static final int TIME_EXCEEDED =2; 92 public static final int NO_TABLES = 3; 93 public static final int COMPLETE_JOIN_ORDER = 4; 94 public static final int COST_OF_SORTING = 5; 95 public static final int NO_BEST_PLAN = 6; 96 public static final int MODIFYING_ACCESS_PATHS = 7; 97 public static final int SHORT_CIRCUITING = 8; 98 public static final int SKIPPING_JOIN_ORDER = 9; 99 public static final int ILLEGAL_USER_JOIN_ORDER = 10; 100 public static final int USER_JOIN_ORDER_OPTIMIZED = 11; 101 public static final int CONSIDERING_JOIN_ORDER = 12; 102 public static final int TOTAL_COST_NON_SA_PLAN = 13; 103 public static final int TOTAL_COST_SA_PLAN = 14; 104 public static final int TOTAL_COST_WITH_SORTING = 15; 105 public static final int CURRENT_PLAN_IS_SA_PLAN = 16; 106 public static final int CHEAPEST_PLAN_SO_FAR = 17; 107 public static final int PLAN_TYPE = 18; 108 public static final int COST_OF_CHEAPEST_PLAN_SO_FAR = 19; 109 public static final int SORT_NEEDED_FOR_ORDERING = 20; 110 public static final int REMEMBERING_BEST_JOIN_ORDER = 21; 111 public static final int SKIPPING_DUE_TO_EXCESS_MEMORY = 22; 112 public static final int COST_OF_N_SCANS = 23; 113 public static final int HJ_SKIP_NOT_MATERIALIZABLE = 24; 114 public static final int HJ_SKIP_NO_JOIN_COLUMNS = 25; 115 public static final int HJ_HASH_KEY_COLUMNS = 26; 116 public static final int CALLING_ON_JOIN_NODE = 27; 117 public static final int CONSIDERING_JOIN_STRATEGY = 28; 118 public static final int REMEMBERING_BEST_ACCESS_PATH = 29; 119 public static final int NO_MORE_CONGLOMERATES = 30; 120 public static final int CONSIDERING_CONGLOMERATE = 31; 121 public static final int SCANNING_HEAP_FULL_MATCH_ON_UNIQUE_KEY = 32; 122 public static final int ADDING_UNORDERED_OPTIMIZABLE = 33; 123 public static final int CHANGING_ACCESS_PATH_FOR_TABLE = 34; 124 public static final int TABLE_LOCK_NO_START_STOP = 35; 125 public static final int NON_COVERING_INDEX_COST = 36; 126 public static final int ROW_LOCK_ALL_CONSTANT_START_STOP = 37; 127 public static final int ESTIMATING_COST_OF_CONGLOMERATE = 38; 128 public static final int LOOKING_FOR_SPECIFIED_INDEX = 39; 129 public static final int MATCH_SINGLE_ROW_COST = 40; 130 public static final int COST_INCLUDING_EXTRA_1ST_COL_SELECTIVITY = 41; 131 public static final int CALLING_NEXT_ACCESS_PATH = 42; 132 public static final int TABLE_LOCK_OVER_THRESHOLD = 43; 133 public static final int ROW_LOCK_UNDER_THRESHOLD = 44; 134 public static final int COST_INCLUDING_EXTRA_START_STOP = 45; 135 public static final int COST_INCLUDING_EXTRA_QUALIFIER_SELECTIVITY = 46; 136 public static final int COST_INCLUDING_EXTRA_NONQUALIFIER_SELECTIVITY = 47; 137 public static final int COST_OF_NONCOVERING_INDEX = 48; 138 public static final int REMEMBERING_JOIN_STRATEGY = 49; 139 public static final int REMEMBERING_BEST_ACCESS_PATH_SUBSTRING = 50; 140 public static final int REMEMBERING_BEST_SORT_AVOIDANCE_ACCESS_PATH_SUBSTRING = 51; 141 public static final int REMEMBERING_BEST_UNKNOWN_ACCESS_PATH_SUBSTRING = 52; 142 public static final int COST_OF_CONGLOMERATE_SCAN1 = 53; 143 public static final int COST_OF_CONGLOMERATE_SCAN2 = 54; 144 public static final int COST_OF_CONGLOMERATE_SCAN3 = 55; 145 public static final int COST_OF_CONGLOMERATE_SCAN4 = 56; 146 public static final int COST_OF_CONGLOMERATE_SCAN5 = 57; 147 public static final int COST_OF_CONGLOMERATE_SCAN6 = 58; 148 public static final int COST_OF_CONGLOMERATE_SCAN7 = 59; 149 public static final int COST_INCLUDING_COMPOSITE_SEL_FROM_STATS= 60; 150 public static final int COMPOSITE_SEL_FROM_STATS = 61; 151 public static final int COST_INCLUDING_STATS_FOR_INDEX = 62; 152 163 public boolean getNextPermutation() throws StandardException; 164 165 176 public boolean getNextDecoratedPermutation() throws StandardException; 177 178 185 public void costPermutation() throws StandardException; 186 187 203 public void costOptimizable(Optimizable optimizable, 204 TableDescriptor td, 205 ConglomerateDescriptor cd, 206 OptimizablePredicateList predList, 207 CostEstimate outerCost) 208 throws StandardException; 209 210 227 public void considerCost(Optimizable optimizable, 228 OptimizablePredicateList predList, 229 CostEstimate estimatedCost, 230 CostEstimate outerCost) 231 throws StandardException; 232 233 240 public DataDictionary getDataDictionary(); 241 242 248 public void modifyAccessPaths() throws StandardException; 249 250 251 public CostEstimate newCostEstimate(); 252 253 254 public CostEstimate getOptimizedCost(); 255 256 263 public CostEstimate getFinalCost(); 264 265 276 public void prepForNextRound(); 277 278 282 public void setOuterRows(double outerRowCount); 283 284 287 public int getNumberOfJoinStrategies(); 288 289 294 public int tableLockThreshold(); 295 296 299 JoinStrategy getJoinStrategy(int whichStrategy); 300 301 305 JoinStrategy getJoinStrategy(String whichStrategy); 306 307 310 public void trace(int traceFlag, int intParam1, int intParam2, 311 double doubleParam, Object objectParam1); 312 313 318 public int getLevel(); 319 320 338 double uniqueJoinWithOuterTable(OptimizablePredicateList predList) 339 throws StandardException; 340 341 349 public boolean useStatistics(); 350 351 354 public int getMaxMemoryPerTable(); 355 } 356 | Popular Tags |