Re: On query rewrite - Mailing list pgsql-hackers

From Sailesh Krishnamurthy
Subject Re: On query rewrite
Date
Msg-id mjq7juxuyr0.fsf@cs.berkeley.edu
Whole thread Raw
In response to Re: On query rewrite  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Responses Re: On query rewrite
List pgsql-hackers
>>>>> "Alvaro" == Alvaro Herrera <alvherre@dcc.uchile.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
theoptimizer works on the output of   Alvaro> rewriting.  So actually the optimizations happen whether   Alvaro> there
wereor 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




pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Win32, PITR, nested transactions, tablespaces
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Win32, PITR, nested transactions, tablespaces