Re: Rewritten queries - Mailing list pgsql-novice

From Jaime Casanova
Subject Re: Rewritten queries
Date
Msg-id 20041227185929.76327.qmail@web50005.mail.yahoo.com
Whole thread Raw
In response to Rewritten queries  ("Keith Worthington" <keithw@narrowpathinc.com>)
List pgsql-novice
 --- Keith Worthington <keithw@narrowpathinc.com>
escribió:
> Hi All,
>
> I wrote a query that created a view and when I
> looked at it in the database
> the SELECT statement was very different.
> ...
> Is this expected behavior?

Yes. Sometimes postgres will rewrite your queries.

> Should I be concerned?

Actually, no. If a query has to be rewritten Postgres
always will rewrite the query before execution. In a
view it doesn't want to do that every time so it
create the view with the modified query.

> Is the modified query faster?

Sometimes, but not necesarilly.

> Better in some way?

I think is just a way to manage different sintaxis
that do the same. But i can be wrong.

For example queries with field1 IN (value1, value2)
will be rewritten like
(field1 = value1 or field1 = value2)

> Should I be writing my queries to conform with
> the modified syntax?
>
If u want. I do not if u can gain some performance
when the query will be no rewritten. I do not.

regards,
Jaime Casanova

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

pgsql-novice by date:

Previous
From: "Keith Worthington"
Date:
Subject: Rewritten queries
Next
From: Jaime Casanova
Date:
Subject: Re: Rewritten queries