On Thu, May 27, 2004 at 05:14:48PM -0700, Sailesh Krishnamurthy wrote:
> Are there any default query rewrite rules that kick in, in the absence
> of any user-defined RULE or VIEW ?
>
> Also, is there any place that lists any "interesting" query rewrite
> that PG does on queries for perf. improvement ?
>
> For instance, in the presence of a view or a subquery, does PG do a
> subquery to join transformation ?
Yes, there are transformations of this sort, but they are not called
query rewrite in the code's terminology, but "optimization" -- rewrite
(rules and views) happens to the parsed statement, and the optimizer
works on the output of rewriting. So actually the optimizations happen
whether there were or not rules or views.
The query's path is
SQL -> parse -> rewrite -> optimize -> execute
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El número de instalaciones de UNIX se ha elevado a 10,
y se espera que este número aumente" (UPM, 1972)