Hello,

On Mon, 1 Mar 2010 10:12:29 +0100
Jean-Christophe Arnu <[email protected]> wrote:

> That's true, views are evaluated each time.

Ah, that's interesting. This would mean that :

 left join cities_area_by_name on city='Toulouse'

has the effect of doing the query in the cities_area_by_name view for
each street, while it is useless.

> Depending on the query it could be painful to get performance out of
> the query. Maybe instead of the view, there might be interesting to
> write an SQL stored procedure with immutable  attribute and returning
> a set of (rows) data retrieved by the view. Thus PostgreSQL will
> evalutate the function once and then use the cache for each row, each
> time it is called.

Hum, I'll need to have a look at PostgreSQL stored procedures, because
these things are new for me (I'm a database newbie).

Using the result of explain sent by David Mentré, do you have a more
detailed analysis of the problem ?

Thanks a lot for your feedback!

Thomas
-- 
Thomas Petazzoni                         http://thomas.enix.org
Promouvoir et défendre le Logiciel Libre http://www.april.org
Logiciels Libres à Toulouse              http://www.toulibre.org

Attachment: signature.asc
Description: PGP signature

Reply via email to