pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Horimoto Yasuhiro <horimoto@clear-code.com>
To: tgl@sss.pgh.pa.us
Cc: david.g.johnston@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16303: A condtion whether an index-only scan is possible includes a wrong
Date: Wed, 18 Mar 2020 09:34:31 +0900 (JST)
Message-ID: <20200318.093431.280154679895579436.horimoto@clear-code.com> (raw)
In-Reply-To: <5148.1584372043@sss.pgh.pa.us>
References: <CAKFQuwaJYP75bMkRZfFqJZaYLQULC_kkLB_nYc2Y3p3oUPOGQg@mail.gmail.com>
	<20200316.172230.2295109568745072390.horimoto@clear-code.com>
	<5148.1584372043@sss.pgh.pa.us>

Hello,

Thank you for your explanation.
I understand what you say.

Thank you,

From: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: BUG #16303: A condtion whether an index-only scan is possible includes a wrong
Date: Mon, 16 Mar 2020 11:20:43 -0400

> Horimoto Yasuhiro <horimoto@clear-code.com> writes:
>> So I think that choosing index-only scan for this case (false is returned by gistcanreturn() case)
>> isn't expected behavior.
> 
> You're mistaken.  An index-only scan is not only useful but potentially
> quite desirable for queries such as count(*); in the best case it ends
> up just counting the index entries without ever visiting the heap at all.
> 
> It does look a bit weird that we might select an IOS for an index type
> that can't ever return any column values, but so far as I can see it
> should work fine.  The index isn't being asked to do anything that it
> doesn't have to do anyway, ie, return the correct set of heap TIDs.
> Testing locally with a GIST index gives the right answers, too.
> 
>> We found the problem I reported with PGroonga:
>> https://github.com/pgroonga/pgroonga/issues/101
> 
>> This problem causes an error because PGroonga can't return
>> IndexScanDesc::xs_itup but IndexScanDesc::xs_want_itup is true.
>> Because PostgreSQL requests index-only scan even when PGroonga
>> returns false by amcanreturn().
> 
> You should be returning an empty, zero-column tuple (either itup
> or htup format) in that situation.  The limit of "I don't have
> any columns I can return" is to form a tuple with no columns,
> not to fail to form a tuple.
> 
> 			regards, tom lane
> 
> 





view thread (6+ messages)

Message-ID: <20200318.093431.280154679895579436.horimoto@clear-code.com>
Permalink:  ../20200318.093431.280154679895579436.horimoto@clear-code.com/
Also on:    postgresql.org/message-id/20200318.093431.280154679895579436.horimoto@clear-code.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: horimoto@clear-code.com, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com
  Subject: Re: BUG #16303: A condtion whether an index-only scan is possible includes a wrong
  In-Reply-To: <20200318.093431.280154679895579436.horimoto@clear-code.com>
  References: <CAKFQuwaJYP75bMkRZfFqJZaYLQULC_kkLB_nYc2Y3p3oUPOGQg@mail.gmail.com> <20200316.172230.2295109568745072390.horimoto@clear-code.com> <5148.1584372043@sss.pgh.pa.us> <20200318.093431.280154679895579436.horimoto@clear-code.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox