Re: An Idea for planner hints - Mailing list pgsql-hackers

From Tom Lane
Subject Re: An Idea for planner hints
Date
Msg-id 14860.1155090146@sss.pgh.pa.us
Whole thread Raw
In response to Re: An Idea for planner hints  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> My main problem is that selectivity is the wrong measurement. What
> users really want to be able to communicate is:

> 1. If you join tables a and b on x, the number of resulting rows will be
> the number of roows selected from b (since b.x id a foreign key
> referencing a.x).

FWIW, I believe the planner already gets that case right, because a.x
will be unique and it should know that.  (Maybe not if the FK is across
a multi-column key, but in principle it should get it right.)

I agree though that meta-knowledge like this is important, and that
standard SQL frequently doesn't provide any adequate way to declare it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Casts
Next
From: Bruce Momjian
Date:
Subject: Re: 8.2 features status