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:35:47
Message-ID: 20190924.173547.226622711.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2019-09-24 08:40:44 Re: [PATCH] Speedup truncates of relation forks
Previous Message Benjie Gillam 2019-09-24 07:48:33 Re: [PATCH] Sort policies and triggers by table name in pg_dump.