An Evolutionary Algorithm for Query Optimization in Database

Download An Evolutionary Algorithm for Query Optimization in Database

Post on 30-Dec-2015

57 views

Category:

Documents

3 download

DESCRIPTION

An Evolutionary Algorithm for Query Optimization in Database. Kayvan Asghari, Ali Safari Mamaghani Mohammad Reza Meybodi International Joint Conferences on Computer, Information, and Systems Sciences, and Engineering CISSE 2007. Introduction. - PowerPoint PPT Presentation

TRANSCRIPT

  • An Evolutionary Algorithm for Query Optimizationin Database Kayvan Asghari, Ali Safari Mamaghani Mohammad Reza Meybodi

    International Joint Conferences on Computer, Information, and Systems Sciences, and EngineeringCISSE 2007

  • IntroductionOptimizing the database queries is one of hard research problemsIf the number of relations is more than five or six relations, exhaustive search techniques will bear high cost regarding the memory and time.Examples of queries with large number of relations can be found in: Deductive database management systemsExpert systemsEngineering database management systems (CAD/CAM)Decision Support SystemsData miningScientific database management systemsWhatever the reason, database management systems need the use of query optimizing techniques with low cost in order to counteract with such complicated queries.

  • Searching Algorithms for Suitable Join OrderExact algorithms that search all of state space and sometimes they reduce this space by heuristic methods: Dynamic programming method which at first introduced by Selinger et al. for optimizing the join ordering in System-R.Minimum selectivity algorithm KBZ algorithm AB algorithm But Exhaustive search techniques like dynamic programming is suitable for queries with a few relation and we have to use random and evolutionary methodsRandom algorithms have been introduced for showing the inability of exact algorithms versus large queries. Iterative improvement Simulated annealing Two-phase optimization Toured simulated annealing Random sampling Evolutionary algorithms

  • Evolutionary algorithms Genetic algorithm has been done by Bennet et al. Some other works have been done by Steinbrunn et al. that they have used different coding methods and genetic operators genetic programming which is introduced by Stillger et al. CGO genetic optimizer has also been introduced by Mulero et al. In our paper a hybrid evolutionary algorithm has been proposed that uses two methods of genetic algorithm and learning automata synchronically for searching the states space of problem.

  • The Definition of Problem

    DBMS selects the best query execution plan (qep) from among execution plans, in a way that query execution bears the low cost, especially the cost of input/output operations and time of processing. If we show the all of allocated execution plans for responding to the query with S set, each member qep that belongs to S set has cost(qep) The purpose of each optimization algorithm is finding a member like qep0 which belongs to S set, so that:

    Processing and Optimizing the join operators in query are difficult Join operator considers two relations as input and combines their tuples one by one on the basis of a definite criterion and produce a new relation as output.The join operator has associative and commutative features thus the number of execution plans for responding to a query increases exponentially when the number of joins among relations increases.

  • Learning automataLearning automata approach for learning involves determination of an optimal action from a set of allowable actions. It selects an action from its finite set of actions.

  • Proposed Hybrid Algorithm for Solving Join Ordering Problem

    Combining genetic algorithms and learning automata Generation, penalty and reward are some of features of hybrid algorithm.In proposed algorithm, unlike classical genetic algorithm, binary coding or natural permutation representations aren't used for chromosomes. Each chromosome is represented by learning automata of object migration kind Each of genes in chromosome is attributed to one of automata actions, and is placed in a definite depth of that action.

  • Learning automata of object migration kindIn these automata, is set of allowed actions of automata. Is set of states and N is memory depth for automata. Now consider the following query: (AC) and (BC) and (CD) and (DE)An example of a query graph :

    E

  • Learning automata of object migration kindDisplay of joins permutation (p3, p2, p1, p4) by learning automata based on Tsetlin automata connections

  • Fitness functionThe purpose of searching the optimized order of query joins is finding permutation of join operators, so that total cost of query execution is minimized in this permutation. One important point in computing fitness function is the number of references to the disc so we can define the fitness function of F for an execution plan like qep as follows:

  • Operators of Hybrid genetic algorithm Selection operator: The selection used for this algorithm is roulette wheel. Crossover Operator: In this operator, two parent chromosomes are selected and two genes i and j are selected randomly in one of the two parent chromosomes. Mutation operator: For executing this operator, we can use different method which are suitable for work with permutations. For example in swap mutation, two actions (genes) from one automata (chromosome) are selected randomly and replaced with each other.

  • Crossover Operator

  • Mutation operator

  • Penalty and Reward Operator In each chromosome, evaluating the fitness rate of a gene which is selected randomly, penalty or reward is given to that gene. As a result of giving penalty or reward, the depth of gene changes. For example, in automata like Tsetlin connections, if p2 join be in states set {6,7,8,9,10}, and the cost for p2 join in the second action will be less than average join costs of chromosome, reward will be given to this join and it's Certainty will be increased and moves toward the internal states of that action.

  • An Example of Reward Operator

  • The manner of giving penalty to the join that is in a state except boundary state

  • The manner of giving penalty to the join that is in a boundary state

  • Experiment Results

    Comparison of averaged cost obtained from hybrid algorism and learning automata based on Tsetline and genetic algorithm Comparison of averaged cost obtained from hybrid algorithm and learning automata based on Krinsky and genetic algorithm

  • Experiment ResultsComparison of averaged cost obtained from hybrid algorithm and learning automata based on Krylov and genetic algorithm Comparison of averaged cost obtained from hybrid algorithm and learning automata based on Oomen and genetic algorithm

  • Experiment ResultsComparison of averaged cost obtained from hybrid algorithms based on different Automata Comparison of averaged cost obtained from hybrid algorithms based on different Automata depth

    Chart1

    23934.7542955.2533144.7545379.5

    2457926542.2533449.546158.5

    24266.529389.7532564.2543912

    2456830578.2532629.7543740.25

    25203.253091232038.545010.75

    24874.531602.533194.542664.75

    GALA - Krinisky

    GALA - Krylov

    GALA - Oomen

    GALA - Tsetlin

    Depth of Automata

    Cost of Query Execution

    Sheet1

    Average of costalgorithmtype

    GALAGALA TotalGrand Total

    heightKriniskyKrylovOomenTsetlin

    123934.7542955.2533144.7545379.536353.562536353.5625

    32457926542.2533449.546158.532682.312532682.3125

    524266.529389.7532564.254391232533.12532533.125

    72456830578.2532629.7543740.2532879.062532879.0625

    925203.253091232038.545010.7533291.12533291.125

    1124874.531602.533194.542664.7533068.285714285733068.2857142857

    Grand Total2457131996.666666666732804.363636363644477.62533476.41489361733476.414893617

    Sheet2

    IDalgorithmtypejoin_numberiterationcrossover_ratemutation_rateheightcost

    4952GALATsetlin802000.90.1144289

    4953GALATsetlin802000.90.1153812

    4954GALATsetlin802000.90.1146059

    4955GALATsetlin802000.90.1137358

    4956GALAKrylov802000.90.1141616

    4957GALAKrylov802000.90.1145203

    4958GALAKrylov802000.90.1143787

    4959GALAKrylov802000.90.1141215

    4960GALAKrinisky802000.90.1123673

    4961GALAKrinisky802000.90.1124316

    4962GALAKrinisky802000.90.1123808

    4963GALAKrinisky802000.90.1123942

    4964GALAOomen802000.90.1134705

    4965GALAOomen802000.90.1133884

    4966GALAOomen802000.90.1133845

    4967GALAOomen802000.90.1130145

    4968GALATsetlin802000.90.1343047

    4969GALATsetlin802000.90.1350530

    4970GALATsetlin802000.90.1344799

    4971GALATsetlin802000.90.1346258

    4972GALAKrylov802000.90.1327557

    4973GALAKrylov802000.90.1326705

    4974GALAKrylov802000.90.1325815

    4975GALAKrylov802000.90.1326092

    4976GALAKrinisky802000.90.1324732

    4977GALAKrinisky802000.90.1324449

    4978GALAKrinisky802000.90.1324630

    4979GALAKrinisky802000.90.1324505

    4980GALAOomen802000.90.1334176

    4981GALAOomen802000.90.1332807

    4982GALAOomen802000.90.1334396

    4983GALAOomen802000.90.1332419

    4984GALATsetlin802000.90.1540970

    4985GALATsetlin802000.90.1544434

    4986GALATsetlin802000.90.1543390

    4987GALATsetlin802000.90.1546854

    4988GALAKrylov802000.90.1530017

    4989GALAKrylov802000.90.1527577

    4990GALAKrylov802000.90.1528202

    4991GALAKrylov802000.90.1531763

    4992GALAKrinisky802000.90.1524220

    4993GALAKrinisky802000.90.1524636

    4994GALAKrinisky802000.90.1524500

    4995GALAKrinisky802000.90.1523710

    4996GALAOomen802000.90.1533314

    4997GALAOomen802000.90.1531768

    4998GALAOomen802000.90.1532119

    4999GALAOomen802000.90.1533056

    5000GALATsetlin802000.90.1739661

    5001GALATsetlin802000.90.1751023

    5002GALATsetlin802000.90.1742600

    5003GALATsetlin802000.90.1741677

    5004GALAKrylov802000.90.1728717

    5005GALAKrylov802000.90.1732266

    5006GALAKrylov802000.90.1730345

    5007GALAKrylov802000.90.1730985

    5008GALAKrinisky802000.90.1724925

    5009GALAKrinisky802000.90.1724507

    5010GALAKrinisky802000.90.1724580

    5011GALAKrinisky802000.90.1724260

    5012GALAOomen802000.90.1735719

    5013GALAOomen802000.90.1732427

    5014GALAOomen802000.90.1731321

    5015GALAOomen802000.90.1731052

    5016GALATsetlin802000.90.1939318

    5017GALATsetlin802000.90.1948827

    5018GALATsetlin802000.90.1951090

    5019GALATsetlin802000.90.1940808

    5020GALAKrylov802000.90.1932402

    5021GALAKrylov802000.90.1931091

    5022GALAKrylov802000.90.1931652

    5023GALAKrylov802000.90.1928503

    5024GALAKrinisky802000.90.1925053

    5025GALAKrinisky802000.90.1925146

    5026GALAKrinisky802000.90.1924859

    5027GALAKrinisky802000.90.1925755

    5028GALAOomen802000.90.1931720

    5029GALAOomen802000.90.1933242

    5030GALAOomen802000.90.1931023

    5031GALAOomen802000.90.1932169

    5032GALATsetlin802000.90.11142542

    5033GALATsetlin802000.90.11145821

    5034GALATsetlin802000.90.11141190

    5035GALATsetlin802000.90.11141106

    5036GALAKrylov802000.90.11130011

    5037GALAKrylov802000.90.11131014

    5038GALAKrylov802000.90.11132789

    5039GALAKrylov802000.90.11132596

    5040GALAKrinisky802000.90.11125205

    5041GALAKrinisky802000.90.11124725

    5042GALAKrinisky802000.90.11124789

    5043GALAKrinisky802000.90.11124779

    5044GALAOomen802000.90.11132958

    5045GALAOomen802000.90.11133431

Recommended

View more >