Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)
Date
Msg-id 16907.1112883624@sss.pgh.pa.us
Whole thread Raw
In response to Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-hackers
Bruno Wolff III <bruno@wolff.to> writes:
>   Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Can anyone suggest a more general rule?

> I think it makes sense to guess that a smaller fraction of the rows will
> be returned when a column value is bounded above and below than if it
> is only bounded on one side, even if the bounds aren't fixed. You can
> certainly be wrong.

Yeah, the whole thing is only a heuristic anyway.  I've been coming
around to the view that relation membership shouldn't matter, because
of cases like

    WHERE a.x > b.y AND a.x < 42

which surely should be taken as a range constraint.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 'now' runtime
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Recognizing range constraints (was Re: [PERFORM] Plan for relatively simple query seems to be very inefficient)