blob: 7d4ed108886bb7428d472d10e4dce7a3a9f7262e (
plain)
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
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>
Among all relational operators the most difficult one to process
and optimize is the <em class="firstterm">join</em>. The number of
possible query plans grows exponentially with the
number of joins in the query. Further optimization effort is
caused by the support of a variety of <em class="firstterm">join
methods</em> (e.g., nested loop, hash join, merge join in
<span class="productname">PostgreSQL</span>) to process individual joins
and a diversity of <em class="firstterm">indexes</em> (e.g.,
B-tree, hash, GiST and GIN in <span class="productname">PostgreSQL</span>) as
access paths for relations.
</p><p>
The normal <span class="productname">PostgreSQL</span> query optimizer
performs a <em class="firstterm">near-exhaustive search</em> over the
space of alternative strategies. This algorithm, first introduced
in IBM's System R database, produces a near-optimal join order,
but can take an enormous amount of time and memory space when the
number of joins in the query grows large. This makes the ordinary
<span class="productname">PostgreSQL</span> query optimizer
inappropriate for queries that join a large number of tables.
</p><p>
The Institute of Automatic Control at the University of Mining and
Technology, in Freiberg, Germany, encountered some problems when
it wanted to use <span class="productname">PostgreSQL</span> as the
backend for a decision support knowledge based system for the
maintenance of an electrical power grid. The DBMS needed to handle
large join queries for the inference machine of the knowledge
based system. The number of joins in these queries made using the
normal query optimizer infeasible.
</p><p>
In the following we describe the implementation of a
<em class="firstterm">genetic algorithm</em> to solve the join
ordering problem in a manner that is efficient for queries
involving large numbers of joins.
</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>
|