pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marc Cousin <cousinmarc@gmail.com>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Avoid full GIN index scan when possible
Date: Tue, 30 Jul 2019 13:27:48 -0400
Message-ID: <27217.1564507668@sss.pgh.pa.us> (raw)
In-Reply-To: <eca8612b-e289-e2fc-c5df-84be46f75ec1@gmail.com>
References: <CAOBaU_YGP5-BEt5Cc0=zMve92vocPzD+XiZgiZs1kjY0cj=XBg@mail.gmail.com>
	<CAOBaU_ZCg4955_HGcQZdn44wtTQRpiHkLgkVsxqQ5cfymDL-XQ@mail.gmail.com>
	<20190628161051.szk2kxmue6yjdmra@development>
	<CAOBaU_ZCJBm3mGvJpMN4VX4Q2oQvgPEwMA1jJyrb7-P0HJbnQA@mail.gmail.com>
	<4547.1561748599@sss.pgh.pa.us>
	<20190628195401.frwhcga76rrytbc4@development>
	<7773.1561752983@sss.pgh.pa.us>
	<CAOBaU_bDF-7E5x0WVPmmtoc+0z7S3hmcXnnV+1ggy8CMGyZxgg@mail.gmail.com>
	<eca8612b-e289-e2fc-c5df-84be46f75ec1@gmail.com>

Marc Cousin <cousinmarc@gmail.com> writes:
> By the way, while preparing this, I noticed that it seems that during this kind of index scan, the interrupt signal is masked
> for a very long time. Control-C takes a very long while to cancel the query. But it's an entirely different problem :)

Yeah, that seems like an independent problem/patch, but it's not obvious
where to fix --- can you provide a self-contained test case?

Meanwhile, I looked at the v3 patch, and it seems like it might not be
too far from committable.  I think we should *not* let this get bogged
down in questions of whether EXPLAIN can report which index quals were
used or ignored.  That's a problem that's existed for decades in the
btree code, with more or less zero user complaints.

I do think v3 needs more attention to comments, for instance this
hunk is clearly falsifying the adjacent comment:

@ -141,7 +141,8 @@ ginFillScanKey(GinScanOpaque so, OffsetNumber attnum,
 	uint32		i;
 
 	/* Non-default search modes add one "hidden" entry to each key */
-	if (searchMode != GIN_SEARCH_MODE_DEFAULT)
+	if (searchMode != GIN_SEARCH_MODE_DEFAULT &&
+		(searchMode != GIN_SEARCH_MODE_ALL || nQueryValues))
 		nQueryValues++;
 	key->nentries = nQueryValues;
 	key->nuserentries = nUserQueryValues;

Also, I agree with Julien that this

+			so->forcedRecheck = key->triConsistentFn(key) != GIN_TRUE;

probably needs to be

+			so->forcedRecheck |= key->triConsistentFn(key) != GIN_TRUE;


			regards, tom lane





view thread (54+ messages)  latest in thread

Message-ID: <27217.1564507668@sss.pgh.pa.us>
Permalink:  ../27217.1564507668@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27217.1564507668@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cousinmarc@gmail.com, a.korotkov@postgrespro.ru, rjuju123@gmail.com, tomas.vondra@2ndquadrant.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
  Subject: Re: Avoid full GIN index scan when possible
  In-Reply-To: <27217.1564507668@sss.pgh.pa.us>

* 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