Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)

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
(view: 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)
List: pgsql-hackers


Bruno Wolff III <> writes:
>   Tom Lane <> 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:

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