Skip site navigation (1) Skip section navigation (2)

Re: On query rewrite

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Sailesh Krishnamurthy <sailesh(at)cs(dot)berkeley(dot)edu>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: On query rewrite
Date: 2004-05-28 00:44:10
Message-ID: 20040528004410.GB9889@dcc.uchile.cl (view raw or flat)
Thread:
Lists: pgsql-hackers
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)


In response to

Responses

pgsql-hackers by date

Next:From: Tatsuo IshiiDate: 2004-05-28 01:05:52
Subject: Re: Win32, PITR, nested transactions, tablespaces
Previous:From: Sailesh KrishnamurthyDate: 2004-05-28 00:14:48
Subject: On query rewrite

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group