Class Optimizer


  • class Optimizer
    extends java.lang.Object
    The optimizer is responsible to find the best execution plan for a given query.
    • Method Detail

      • getMaxBruteForceFilters

        private static int getMaxBruteForceFilters​(int filterCount)
        How many filter to calculate using brute force. The remaining filters are selected using a greedy algorithm which has a runtime of (1 + 2 + ... + n) = (n * (n-1) / 2) for n filters. The brute force algorithm has a runtime of n * (n-1) * ... * (n-m) when calculating m brute force of n total. The combined runtime is (brute force) * (greedy).
        Parameters:
        filterCount - the number of filters total
        Returns:
        the number of filters to calculate using brute force
      • calculateBestPlan

        private void calculateBestPlan()
      • calculateFakePlan

        private void calculateFakePlan()
      • canStop

        private boolean canStop​(int x)
      • calculateBruteForceAll

        private void calculateBruteForceAll()
      • calculateBruteForceSome

        private void calculateBruteForceSome()
      • calculateGenetic

        private void calculateGenetic()
      • testPlan

        private boolean testPlan​(TableFilter[] list)
      • shuffleAll

        private void shuffleAll​(TableFilter[] f)
      • shuffleTwo

        private boolean shuffleTwo​(TableFilter[] f)
      • optimize

        void optimize​(boolean parse)
        Calculate the best query plan to use.
        Parameters:
        parse - If we do not need to really get the best plan because it is a view parsing stage.
      • getCost

        double getCost()