codekingpro/portable-devtools
114k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>62.1. Query Handling as a Complex Optimization Problem</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="geqo.html" title="Chapter 62. Genetic Query Optimizer" /><link rel="next" href="geqo-intro2.html" title="62.2. Genetic Algorithms" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">62.1. Query Handling as a Complex Optimization Problem</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="geqo.html" title="Chapter 62. Genetic Query Optimizer">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="geqo.html" title="Chapter 62. Genetic Query Optimizer">Up</a></td><th width="60%" align="center">Chapter 62. Genetic Query Optimizer</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="geqo-intro2.html" title="62.2. Genetic Algorithms">Next</a></td></tr></table><hr /></div><div class="sect1" id="GEQO-INTRO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">62.1. Query Handling as a Complex Optimization Problem <a href="#GEQO-INTRO" class="id_link">#</a></h2></div></div></div><p>3 Among all relational operators the most difficult one to process4 and optimize is the <em class="firstterm">join</em>. The number of5 possible query plans grows exponentially with the6 number of joins in the query. Further optimization effort is7 caused by the support of a variety of <em class="firstterm">join8 methods</em> (e.g., nested loop, hash join, merge join in9 <span class="productname">PostgreSQL</span>) to process individual joins10 and a diversity of <em class="firstterm">indexes</em> (e.g.,11 B-tree, hash, GiST and GIN in <span class="productname">PostgreSQL</span>) as12 access paths for relations.13 </p><p>14 The normal <span class="productname">PostgreSQL</span> query optimizer15 performs a <em class="firstterm">near-exhaustive search</em> over the16 space of alternative strategies. This algorithm, first introduced17 in IBM's System R database, produces a near-optimal join order,18 but can take an enormous amount of time and memory space when the19 number of joins in the query grows large. This makes the ordinary20 <span class="productname">PostgreSQL</span> query optimizer21 inappropriate for queries that join a large number of tables.22 </p><p>23 The Institute of Automatic Control at the University of Mining and24 Technology, in Freiberg, Germany, encountered some problems when25 it wanted to use <span class="productname">PostgreSQL</span> as the26 backend for a decision support knowledge based system for the27 maintenance of an electrical power grid. The DBMS needed to handle28 large join queries for the inference machine of the knowledge29 based system. The number of joins in these queries made using the30 normal query optimizer infeasible.31 </p><p>32 In the following we describe the implementation of a33 <em class="firstterm">genetic algorithm</em> to solve the join34 ordering problem in a manner that is efficient for queries35 involving large numbers of joins.36 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="geqo.html" title="Chapter 62. Genetic Query Optimizer">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="geqo.html" title="Chapter 62. Genetic Query Optimizer">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="geqo-intro2.html" title="62.2. Genetic Algorithms">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 62. Genetic Query Optimizer </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 62.2. Genetic Algorithms</td></tr></table></div></body></html>