Re: Pruning useless tables for queries - Mailing list pgsql-hackers

From Zeugswetter Andreas SB SD
Subject Re: Pruning useless tables for queries
Date
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA4961FB9@m0114.s-mxs.net
Whole thread Raw
In response to Pruning useless tables for queries  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
> > One optimisation is for the query planner to drop tables whose output do not
> > affect the final result (where the WHERE clauses and the CHECK constraints
> > prove that no rows can be returned). While this is not the case for simple
> > queries, when involving views and inheritance it's very easy to do.
>
> Under what conditions is this actually going to buy you anything?
>
> Indexscans with self-contradictory index conditions, for example, fall
> through quite quickly already (look at the scan startup logic in nbtree.c).
> I'm not sure that there's any gain in having the planner duplicate that
> effort.

It covers cases that have check constraints on columns without an index, or
that have an index, but another index is chosen by the planner because it
looks cheaper. Maybe part of the startup logic in nbtree.c can be moved to
the planner, so it covers more cases and is not duplicated ?

There is a question whether this is useful for normal table access, since
most applications won't query on values that are not allowed. But for views
(especially union all) and inheritance it would imho certainly be very valuable.

Andreas


pgsql-hackers by date:

Previous
From: Jean-Michel POURE
Date:
Subject: Tetra-bytes database / large indexes needs
Next
From: "Dave Page"
Date:
Subject: Re: problem to send mail