Re: Queries joining views - Mailing list pgsql-general

From John D. Burger
Subject Re: Queries joining views
Date
Msg-id b84a95d0ee93bd4777c5dcacccdca8b0@mitre.org
Whole thread Raw
In response to Queries joining views  (Alban Hertroys <alban@magproductions.nl>)
Responses Re: Queries joining views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Alban Hertroys wrote:

> We have a number of views that join tables, and we have queries that
> join those views. Some relatively large tables are involved.
> We added indexes that match our query constraints as much as possible,
> and that does work if we explicitly query the tables with all the
> involved joins, instead of the views. However, if we query the views,
> the planner starts using a filter instead of the desired index...

Anecdotally, I had a situation recently where I got different plans
depending on whether I queried a join of a view against itself, or
"macro expanded" the view by hand.  I was =very= surprised at this.

- John D. Burger
   MITRE


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: cannot open pg_database
Next
From: Jeff Davis
Date:
Subject: setting the value returned by PQcmdTuples