Re: Rewritten queries

From: Jaime Casanova <systemguards(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Rewritten queries
Date: 2004-12-27 18:59:29
Message-ID: 20041227185929.76327.qmail@web50005.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

--- Keith Worthington <keithw(at)narrowpathinc(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jaime Casanova 2004-12-27 19:04:29 Re: Rewritten queries
Previous Message Keith Worthington 2004-12-27 18:45:11 Rewritten queries