Re: BETWEEN [SYMMETRIC | ASYMMETRIC]

Поиск
Список
Период
Сортировка
От Thomas Swan
Тема Re: BETWEEN [SYMMETRIC | ASYMMETRIC]
Дата
Msg-id 5.0.2.1.0.20010110100840.01b21ff8@tangent.ics.olemiss.edu
обсуждение исходный текст
Ответ на BETWEEN [SYMMETRIC | ASYMMETRIC]  ("Robert B. Easter" <reaster@comptechnews.com>)
Ответы Re: Re: BETWEEN [SYMMETRIC | ASYMMETRIC]  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
At 1/9/2001 10:29 PM, Tom Lane wrote:
>Thomas Swan <tswan-lst@ics.olemiss.edu> writes:
> > Shouldn't be much of problem... where would I start to look... :)
>
>Well, the Right Way To Do It would be to invent a new expression node
>type that implements both kinds of BETWEEN.  Right now, the parser
>expands A BETWEEN B AND C into "A >= B AND A <= C", which is perfectly
>correct according to the letter of the spec, but it implies evaluating
>the subexpression A twice, which sucks.  Besides which, this doesn't

Actually if it were possible to look at the values before expanding.  You 
could reorder the expression so that it was always the case that B < C, 
then your cost would only be one comparison plus the sequential scan.


>readily generalize to the SYMMETRIC case.  I'd make a new expr node
>type with three subexpressions and a SYMMETRIC bool flag.  If you chase
>down all the places where CaseExpr nodes are processed, and add a
>BetweenExpr case in parallel, you'll have it made.
>
>                         regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pete Forman
Дата:
Сообщение: Re: AW: Re: tinterval - operator problems on AIX
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Re: Beta2 ... ?