X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3A8E6D8E9B for ; Wed, 14 Sep 2005 12:52:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53952-05 for ; Wed, 14 Sep 2005 15:52:54 +0000 (GMT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.194]) by svr1.postgresql.org (Postfix) with ESMTP id 26B8CD8E83 for ; Wed, 14 Sep 2005 12:52:51 -0300 (ADT) Received: by xproxy.gmail.com with SMTP id i28so27691wxd for ; Wed, 14 Sep 2005 08:52:51 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VSUuXya/hIb5dywlDzC9uJajAHXwfyHh4Ul+a+poSxJACkDYkub8acbzG2YIMkJAYPcay6JPj6EKTtJaHllxNXY9Ukox1pz2hiCTRrcK+xwd/QJ9QTEm6QH2hU6qFhaw2RUMG4REVHMzP6HRcFtoKEo75y3Ox268cI1O/ybCQH0= Received: by 10.70.132.9 with SMTP id f9mr303513wxd; Wed, 14 Sep 2005 08:52:50 -0700 (PDT) Received: by 10.70.18.3 with HTTP; Wed, 14 Sep 2005 08:52:50 -0700 (PDT) Message-ID: Date: Wed, 14 Sep 2005 12:52:50 -0300 From: Pryscila B Guttoski Reply-To: pryscila.lista@gmail.com To: jonah.harris@gmail.com Subject: Re: About method of PostgreSQL's Optimizer Cc: pgsql-hackers@postgresql.org In-Reply-To: <36e6829205091320085993ceba@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <36e6829205091320085993ceba@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.587 required=5 tests=[AWL=0.563, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200509/662 X-Sequence-Number: 73059 Hi Jonah, Thank's for your email, I really appreciate your opinions. Is it interesting to use both techniques? For example: Given a query, an optimizer: 1. Generates one of the possible execution plans. 2. Does transformations on the original plan, based on rules and heuristics, resulting in new alternative plans. 3. Evaluates the cost of generated plans by using statistics. 4. Keeps plans that have lower cost than the original plan 5. Repeat 2-4 over the new alternative plans. What do you think about it? Are there any restrictions that I haven't seen? About other method... Have you heard about using PDDL ("Planning Domain Definition Language") for query optimization? []'s Pryscila On 9/14/05, Jonah H. Harris wrote: > Pryscila, > =20 > While I haven't been too involved in the open source PostgreSQL optimize= r, > I have done some work on it and optimizers in other database systems. > =20 > Based on my work, it is my opinion that PostgreSQL, as-well-as other > databases which use a cost-based optimizer, prefer a breadth-first algori= thm > because one cannot determine the "real" cost of each node at run-time > without systematically examining all possibilities through calculation.= =20 > This is the opposite of a rule-based optimizer which defines heuristics > which can be evaulated by a best-first algorithm such as A*. > =20 > In a cost-based optimizer, the system must calculate the "cost" of each > path based on data that changes during run-time including indexing, > cardinality, tuple size, available memory, CPU usage, disk access times, > etc. To a cost-based optimizer, every query is unique and therefore cann= ot > follow a weighted path in the same fashion. I can certainly see A* being > used in a rule-based optimizer but not in a real-time cost-based optimize= r. > =20 > Perhaps Tom, Bruce, et al have more specifics on PostgreSQL's > implementation. > =20 > -Jonah >=20 > =20 > =20 > =20 > On 9/13/05, Pryscila B Guttoski wrote: > > Hello all! > >=20 > > On my master course, I'm studying the PostgreSQL's optimizer. > > I don't know if anyone in this list have been participated from the > PostgreSQL's Optimizer development, but maybe someone can help me on this > question. > > PostgreSQL generates all possible plans of executing the query (using a= n > almost exhaustive search), then gives a cost to each plan and finally the > cheapest one is selected for execution. > > There are other methods for query optimization, one of them is based on > plan transformations (for example, using A-Star algorithm) instead of pla= n > constructions used by PostgreSQL.=20 > > Does anyone know why this method was choosen? Are there any papers or > researches about it? > >=20 > > Thank's a lot, > > Pryscila. > >=20 >=20 >=20 >=20 > --=20 > Respectfully, >=20 > Jonah H. Harris, Database Internals Architect > EnterpriseDB Corporation > http://www.enterprisedb.com/=20 >