Between Node

Lists: pgsql-patches
From: Rod Taylor <rbt(at)zort(dot)ca>
To: pgsql-patches(at)postgresql(dot)org
Subject: Between Node
Date: 2002-07-10 01:43:40
Message-ID: 1026265422.14272.4.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Finished the Between patch Christopher started.

Implements between (symmetric / asymmetric) as a node.

Executes the left or right expression once, makes a Const out of the
resulting Datum and executes the >=, <= portions out of the Const sets.

Of course, the parser does a fair amount of preparatory work for this to
happen.

Attachment Content-Type Size
between.patch text/plain 30.1 KB

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Rod Taylor" <rbt(at)zort(dot)ca>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Between Node
Date: 2002-07-10 02:04:44
Message-ID: GNELIHDDFBOCMGBFGEFOGEAOCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Wonderful! It makes me a very happy little punter to see that finished off!

Chris

> -----Original Message-----
> From: pgsql-patches-owner(at)postgresql(dot)org
> [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Rod Taylor
> Sent: Wednesday, 10 July 2002 9:44 AM
> To: pgsql-patches(at)postgresql(dot)org
> Subject: [PATCHES] Between Node
>
>
> Finished the Between patch Christopher started.
>
> Implements between (symmetric / asymmetric) as a node.
>
> Executes the left or right expression once, makes a Const out of the
> resulting Datum and executes the >=, <= portions out of the Const sets.
>
> Of course, the parser does a fair amount of preparatory work for this to
> happen.
>


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Rod Taylor" <rbt(at)zort(dot)ca>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Between Node
Date: 2002-07-10 02:13:18
Message-ID: GNELIHDDFBOCMGBFGEFOOEAOCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

You made a tiny little type in a comment in parsenodes.h (abotu instead of
about).

It's humbling to read the patch and see just how much I had to go when I
gave up!

Chris

> -----Original Message-----
> From: pgsql-patches-owner(at)postgresql(dot)org
> [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Rod Taylor
> Sent: Wednesday, 10 July 2002 9:44 AM
> To: pgsql-patches(at)postgresql(dot)org
> Subject: [PATCHES] Between Node
>
>
> Finished the Between patch Christopher started.
>
> Implements between (symmetric / asymmetric) as a node.
>
> Executes the left or right expression once, makes a Const out of the
> resulting Datum and executes the >=, <= portions out of the Const sets.
>
> Of course, the parser does a fair amount of preparatory work for this to
> happen.
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-16 05:14:38
Message-ID: 200207160514.g6G5EcQ17418@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Rod Taylor wrote:
> Finished the Between patch Christopher started.
>
> Implements between (symmetric / asymmetric) as a node.
>
> Executes the left or right expression once, makes a Const out of the
> resulting Datum and executes the >=, <= portions out of the Const sets.
>
> Of course, the parser does a fair amount of preparatory work for this to
> happen.

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 04:41:35
Message-ID: 200207180441.g6I4fZZ08476@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Rod Taylor wrote:
> Finished the Between patch Christopher started.
>
> Implements between (symmetric / asymmetric) as a node.
>
> Executes the left or right expression once, makes a Const out of the
> resulting Datum and executes the >=, <= portions out of the Const sets.
>
> Of course, the parser does a fair amount of preparatory work for this to
> happen.

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Rod Taylor <rbt(at)zort(dot)ca>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 04:42:33
Message-ID: 200207180442.g6I4gXF08734@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:
> You made a tiny little type in a comment in parsenodes.h (abotu instead of
> about).
>
> It's humbling to read the patch and see just how much I had to go when I
> gave up!
>
> Chris
>
> > -----Original Message-----
> > From: pgsql-patches-owner(at)postgresql(dot)org
> > [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Rod Taylor
> > Sent: Wednesday, 10 July 2002 9:44 AM
> > To: pgsql-patches(at)postgresql(dot)org
> > Subject: [PATCHES] Between Node
> >
> >
> > Finished the Between patch Christopher started.
> >
> > Implements between (symmetric / asymmetric) as a node.
> >
> > Executes the left or right expression once, makes a Const out of the
> > resulting Datum and executes the >=, <= portions out of the Const sets.
> >
> > Of course, the parser does a fair amount of preparatory work for this to
> > happen.
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Rod Taylor" <rbt(at)zort(dot)ca>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Between Node
Date: 2002-07-18 04:56:44
Message-ID: GNELIHDDFBOCMGBFGEFOAEDGCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

I believe Tom mentioned that having BETWEEN as a node would allow him to do
some sort of funky optimiser improvement. Is that already done or does he
still need to do it?

Chris

> -----Original Message-----
> From: pgsql-patches-owner(at)postgresql(dot)org
> [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Bruce Momjian
> Sent: Thursday, 18 July 2002 12:42 PM
> To: Rod Taylor
> Cc: pgsql-patches(at)postgresql(dot)org
> Subject: Re: [PATCHES] Between Node
>
>
>
> Patch applied. Thanks.
>
> ------------------------------------------------------------------
> ---------
>
>
> Rod Taylor wrote:
> > Finished the Between patch Christopher started.
> >
> > Implements between (symmetric / asymmetric) as a node.
> >
> > Executes the left or right expression once, makes a Const out of the
> > resulting Datum and executes the >=, <= portions out of the Const sets.
> >
> > Of course, the parser does a fair amount of preparatory work for this to
> > happen.
>
> [ Attachment, skipping... ]
>
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


From: Rod Taylor <rbt(at)zort(dot)ca>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 11:36:11
Message-ID: 1026992174.280.58.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, 2002-07-18 at 00:56, Christopher Kings-Lynne wrote:
> I believe Tom mentioned that having BETWEEN as a node would allow him to do
> some sort of funky optimiser improvement. Is that already done or does he
> still need to do it?

I don't know what improvement this would be. I only touched the parser
and executor.

It only executes each segment of the between tree once so the only
optimization I can think of would be to try to execute the most likely
to fail leaf first.

> > -----Original Message-----
> > From: pgsql-patches-owner(at)postgresql(dot)org
> > [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Bruce Momjian
> > Sent: Thursday, 18 July 2002 12:42 PM
> > To: Rod Taylor
> > Cc: pgsql-patches(at)postgresql(dot)org
> > Subject: Re: [PATCHES] Between Node
> >
> >
> >
> > Patch applied. Thanks.
> >
> > ------------------------------------------------------------------
> > ---------
> >
> >
> > Rod Taylor wrote:
> > > Finished the Between patch Christopher started.
> > >
> > > Implements between (symmetric / asymmetric) as a node.
> > >
> > > Executes the left or right expression once, makes a Const out of the
> > > resulting Datum and executes the >=, <= portions out of the Const sets.
> > >
> > > Of course, the parser does a fair amount of preparatory work for this to
> > > happen.
> >
> > [ Attachment, skipping... ]
> >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> >
> > --
> > Bruce Momjian | http://candle.pha.pa.us
> > pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> > + If your life is a hard drive, | 830 Blythe Avenue
> > + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 13:39:50
Message-ID: 4874.1026999590@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Rod Taylor <rbt(at)zort(dot)ca> writes:
> On Thu, 2002-07-18 at 00:56, Christopher Kings-Lynne wrote:
>> I believe Tom mentioned that having BETWEEN as a node would allow him to do
>> some sort of funky optimiser improvement. Is that already done or does he
>> still need to do it?

> I don't know what improvement this would be. I only touched the parser
> and executor.

In that case, this code is worse than before as far as developing plans
goes. The selectivity estimator needs to be taught about what BETWEEN
means. Currently it recognizes (x > foo AND x < bar) as a range query
--- a BETWEEN node is obviously much easier to recognize, but you still
have to add code to do it.

regards, tom lane


From: Bruce Momjian <root(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 17:02:01
Message-ID: 200207181702.g6IH21m19002@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Rod, I have backed out this patch because initdb was failing. Please
retest and resubmit. You may want to get the optimizer recoginizing
BETWEEN in the same patch so we don't go backwards in terms of
optimization.

Thanks.

---------------------------------------------------------------------------

Rod Taylor wrote:
> Finished the Between patch Christopher started.
>
> Implements between (symmetric / asymmetric) as a node.
>
> Executes the left or right expression once, makes a Const out of the
> resulting Datum and executes the >=, <= portions out of the Const sets.
>
> Of course, the parser does a fair amount of preparatory work for this to
> happen.

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
root(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 17:04:16
Message-ID: 200207181704.g6IH4GG19490@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Rod, I have backed out this patch because initdb was failing. Please
retest and resubmit. You may want to get the optimizer recoginizing
BETWEEN in the same patch so we don't go backwards in terms of
optimization.

---------------------------------------------------------------------------

Rod Taylor wrote:
> Finished the Between patch Christopher started.
>
> Implements between (symmetric / asymmetric) as a node.
>
> Executes the left or right expression once, makes a Const out of the
> resulting Datum and executes the >=, <= portions out of the Const sets.
>
> Of course, the parser does a fair amount of preparatory work for this to
> happen.

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Rod Taylor <rbt(at)zort(dot)ca>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 17:39:16
Message-ID: 1027013958.280.103.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Ok, I'll pull a fresh copy of cvs source and see what I can do. My
current working area isn't causing any problems.

On Thu, 2002-07-18 at 13:04, Bruce Momjian wrote:
>
> Rod, I have backed out this patch because initdb was failing. Please
> retest and resubmit. You may want to get the optimizer recoginizing
> BETWEEN in the same patch so we don't go backwards in terms of
> optimization.
>
> ---------------------------------------------------------------------------
>
> Rod Taylor wrote:
> > Finished the Between patch Christopher started.
> >
> > Implements between (symmetric / asymmetric) as a node.
> >
> > Executes the left or right expression once, makes a Const out of the
> > resulting Datum and executes the >=, <= portions out of the Const sets.
> >
> > Of course, the parser does a fair amount of preparatory work for this to
> > happen.
>
> [ Attachment, skipping... ]
>
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 20:04:55
Message-ID: 200207182004.g6IK4te11261@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Rod Taylor wrote:
> Ok, I'll pull a fresh copy of cvs source and see what I can do. My
> current working area isn't causing any problems.

I think the depencency stuff may have affected your patch.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Rod Taylor <rbt(at)zort(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 20:29:02
Message-ID: 1027024143.280.135.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, 2002-07-18 at 09:39, Tom Lane wrote:
> Rod Taylor <rbt(at)zort(dot)ca> writes:
> > On Thu, 2002-07-18 at 00:56, Christopher Kings-Lynne wrote:
> >> I believe Tom mentioned that having BETWEEN as a node would allow him to do
> >> some sort of funky optimiser improvement. Is that already done or does he
> >> still need to do it?
>
> > I don't know what improvement this would be. I only touched the parser
> > and executor.
>
> In that case, this code is worse than before as far as developing plans
> goes. The selectivity estimator needs to be taught about what BETWEEN
> means. Currently it recognizes (x > foo AND x < bar) as a range query
> --- a BETWEEN node is obviously much easier to recognize, but you still
> have to add code to do it.
>
> regards, tom lane
>


From: Rod Taylor <rbt(at)zort(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 20:30:27
Message-ID: 1027024227.280.138.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

> In that case, this code is worse than before as far as developing plans
> goes. The selectivity estimator needs to be taught about what BETWEEN
> means. Currently it recognizes (x > foo AND x < bar) as a range query
> --- a BETWEEN node is obviously much easier to recognize, but you still
> have to add code to do it.

I simply multiple the results of the left, right and common expression
after sending them through clause_selectivity() ?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Between Node
Date: 2002-07-18 20:40:18
Message-ID: 8661.1027024818@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Rod Taylor <rbt(at)zort(dot)ca> writes:
>> In that case, this code is worse than before as far as developing plans
>> goes. The selectivity estimator needs to be taught about what BETWEEN
>> means. Currently it recognizes (x > foo AND x < bar) as a range query
>> --- a BETWEEN node is obviously much easier to recognize, but you still
>> have to add code to do it.

> I simply multiple the results of the left, right and common expression
> after sending them through clause_selectivity() ?

Huh? I don't see any "common expression" here. You've got a left
comparison and a right comparison.

Actually, at least for the case of the standard asymmetric BETWEEN
clause, you really really want to be able to generate a bounded
indexscan plan (indexscan with x > foo AND x < bar as indexquals).
That used to happen for free, and now will not happen at all, because
BETWEEN is not in the set of operators recognized as indexscannable
operators. Not sure what the most appropriate fix is --- there are a
number of places that we could try to fix it at, with varying
implications as to the amount of code changed and the generality of
the cases handled.

regards, tom lane