Re: On query rewrite

From: Sailesh Krishnamurthy <sailesh(at)cs(dot)berkeley(dot)edu>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: On query rewrite
Date: 2004-05-28 01:27:47
Message-ID: mjq7juxuyr0.fsf@cs.berkeley.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Alvaro" == Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:

>> For instance, in the presence of a view or a subquery, does PG
>> do a subquery to join transformation ?

Alvaro> Yes, there are transformations of this sort, but they are
Alvaro> not called query rewrite in the code's terminology, but
Alvaro> "optimization" -- rewrite (rules and views) happens to the
Alvaro> parsed statement, and the optimizer works on the output of
Alvaro> rewriting. So actually the optimizations happen whether
Alvaro> there were or not rules or views.

Interesting .. so these are rule-based then ? Not cost-based ?

I understand that there is a cost-based optimizer anyway that does the
planning and selects the right plan .. but does this come _after_ all
these transformations ? Or does it happen along with the
transformations ?

Alvaro> The query's path is SQL -> parse -> rewrite -> optimize ->
Alvaro> execute

Can you please point me to the code that indeed does such
transformations ?

--
Pip-pip
Sailesh
http://www.cs.berkeley.edu/~sailesh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-05-28 02:04:56 Re: Win32, PITR, nested transactions, tablespaces
Previous Message Gavin Sherry 2004-05-28 01:25:25 Re: Tablespaces