Re: Index Skip Scan

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: alvherre(at)2ndquadrant(dot)com
Cc: 9erthalion6(at)gmail(dot)com, florisvannee(at)optiver(dot)com, jesper(dot)pedersen(at)redhat(dot)com, david(dot)rowley(at)2ndquadrant(dot)com, thomas(dot)munro(at)gmail(dot)com, jtc331(at)gmail(dot)com, rafia(dot)pghackers(at)gmail(dot)com, jeff(dot)janes(at)gmail(dot)com, pg(at)bowt(dot)ie, tomas(dot)vondra(at)2ndquadrant(dot)com, thomas(dot)munro(at)enterprisedb(dot)com, bhushan(dot)uparkar(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, a(dot)korotkov(at)postgrespro(dot)ru
Subject: Re: Index Skip Scan
Date: 2019-09-24 08:41:46
Message-ID: 20190924.174146.159197618.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Tue, 24 Sep 2019 17:35:47 +0900 (Tokyo Standard Time), Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote in <20190924(dot)173547(dot)226622711(dot)horikyota(dot)ntt(at)gmail(dot)com>
> At Sun, 22 Sep 2019 23:02:04 -0300, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote in <20190923020204(dot)GA2781(at)alvherre(dot)pgsql>
> > On 2019-Sep-22, Dmitry Dolgov wrote:
> >
> > > > I think multiplying two ScanDirections to watch for a negative result is
> > > > pretty ugly:
> > >
> > > Probably, but the only alternative I see to check if directions are opposite is
> > > to check that directions come in pairs (back, forth), (forth, back). Is there
> > > an easier way?
> >
> > Maybe use the ^ operator?
>
> It's not a logical operator but a bitwise arithmetic operator,
> which cannot be used if the operands is guaranteed to be 0 or 1
> (in integer). In a-kind-of-standard, but hacky way, "(!a != !b)"
> works as desired since ! is a logical operator.
>
> Wouldn't we use (a && !b) || (!a && b)? Compiler will optimize it
> some good way.

Sorry, it's not a boolean. A tristate value. From the definition
(Back, NoMove, Forward) = (-1, 0, 1), (dir1 == -dir2) if
NoMovement did not exist. If it is not guranteed,

(dir1 != 0 && dir1 == -dir2) ?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-09-24 09:30:48 Re: abort-time portal cleanup
Previous Message Fujii Masao 2019-09-24 08:40:44 Re: [PATCH] Speedup truncates of relation forks