Re: Index not used in certain nested views but not in others - Mailing list pgsql-general

From Tom Lane
Subject Re: Index not used in certain nested views but not in others
Date
Msg-id 1400978.1746046929@sss.pgh.pa.us
Whole thread Raw
In response to Index not used in certain nested views but not in others  (Markus Demleitner <msdemlei@ari.uni-heidelberg.de>)
Responses Re: Index not used in certain nested views but not in others
List pgsql-general
Markus Demleitner <msdemlei@ari.uni-heidelberg.de> writes:
> So, when the SELECT statement on dfbsspec.ssa stands along in the view
> definition, Postgres does the right thing; when the exact same query
> stands in a UNION ALL with other tables, Postgres doesn't use the
> index.  Hu?

It's hard to be sure when you've shown us no table definitions and
only fragments of the view definitions.  But I suspect what is
happening here is that the view's UNIONs are causing a data type
coercion of raw_spectra.pub_did before it gets to the top level
of the view output.  That might interfere with the planner's ability
to see that the outer query's join operator is compatible with
the table's index.

            regards, tom lane



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Index not used in certain nested views but not in others
Next
From: Laurenz Albe
Date:
Subject: Re: Index not used in certain nested views but not in others