agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 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>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Marc Cousin <cousinmarc@gmail.com>
Subject: Re: Avoid full GIN index scan when possible
Date: Tue, 14 Jan 2020 18:03:39 -0500
Message-ID: <7614.1579043019@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPpHfdt8vCETJy9xMAvv1QQbOnNUfMfY8-pg+XGqJ-VWq4TNmg@mail.gmail.com>
References: <CAOBaU_b3u1xpoESb2JD6dQ4V7fhwmbfOFW5PiadZHJX6bNdnfw@mail.gmail.com>
	<17590.1564685940@sss.pgh.pa.us>
	<CAPpHfdvfK+Zk=MjjC1M_66+ALD+vdR6BG3quoFAZzjL6hNv-NQ@mail.gmail.com>
	<19189.1564687723@sss.pgh.pa.us>
	<a6e1564e-98c8-e420-cfaf-0309316c4910@postgrespro.ru>
	<19438.1565209940@sss.pgh.pa.us>
	<f2889144-db1d-e3b2-db97-cfc8794cda43@postgrespro.ru>
	<CAPpHfdsXN5iq3rUwjuwtp_GRFmhq+1QAtgiywGM_6YM9PdGdMg@mail.gmail.com>
	<CAPpHfdvT_t6ShG2pvptEWceDxEnyNRsm2MxmCWWvxBzQ-pbMuw@mail.gmail.com>
	<b53614eb-6f9f-8c5c-9df8-f703b0b102b6@postgrespro.ru>
	<20200106152155.uuungi2p776p5lbk@development>
	<CAPpHfdthhf8S-UjE46hjy+g7pgGhy=hav1-BUmQq6+hKmY13nA@mail.gmail.com>
	<29242.1578670290@sss.pgh.pa.us>
	<CAPpHfdu+rcbqU1fCwvfy60uFodxwWiQqKy_2AVnq4=2SEt+2bA@mail.gmail.com>
	<CAPpHfdttREdy0H9ovJjcd5UUu1my6TS8GRNRuKpL2dTDt8o2wQ@mail.gmail.com>
	<CAOBaU_YJadWvDVO3FQ_hddaTHSreWre6hPSNw=4wY6SskrvLuA@mail.gmail.com>
	<CAPpHfdusQSm6Nx+hipY+ArU0Udr8ZYivWvoCx2AT2Yvujd=WPA@mail.gmail.com>
	<CAPpHfdtW5inx6a! =WRgqHVeE6S74XBf1mJGFSoJ2SMwLz_T_WaA@mail.gmail.com>
	<20952.1579027391@sss.pgh.pa.us>
	<CAPpHfdt8vCETJy9xMAvv1QQbOnNUfMfY8-pg+XGqJ-VWq4TNmg@mail.gmail.com>

Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> On Tue, Jan 14, 2020 at 9:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> One thing I'm still not happy about is the comment in
>> collectMatchesForHeapRow.  v12 failed to touch that at all, so I tried to
>> fill it in, but I'm not sure if my explanation is good.

> I've tried to rephrase this comment making it better from my point of
> view.  It's hard for me to be sure about this, since I'm not native
> English speaker.  I'd like you to take a look on it.

Yeah, that's not great as-is.  Maybe like

+	 * All scan keys except excludeOnly require at least one entry to match.
+	 * excludeOnly keys are an exception, because their implied
+	 * GIN_CAT_EMPTY_QUERY scanEntry always matches.  So return "true"
+	 * if all non-excludeOnly scan keys have at least one match.

>> Also, if we know
>> that excludeOnly keys are going to be ignored, can we save any work in
>> the main loop of that function?

> It doesn't look so for me.  We still need to collect matches for
> consistent function call afterwards.

Ah, right.

> I also had concerns about how excludeOnly keys work with lossy pages.
> I didn't find exact error.  But I've added code, which skips
> excludeOnly keys checks for lossy pages.  They aren't going to exclude
> any lossy page anyway.  So, we can save some resources by skipping
> this.

Hmm ... yeah, these test cases are not large enough to exercise any
lossy-page cases, are they?  I doubt we should try to make a new regression
test that is that big.  (But if there is one already, maybe we could add
more test queries with it, instead of creating whole new tables?)

			regards, tom lane





view thread (54+ messages)  latest in thread

Message-ID: <7614.1579043019@sss.pgh.pa.us>
Permalink:  ../7614.1579043019@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7614.1579043019@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, a.korotkov@postgrespro.ru, rjuju123@gmail.com, tomas.vondra@2ndquadrant.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org, thomas.munro@gmail.com, cousinmarc@gmail.com
  Subject: Re: Avoid full GIN index scan when possible
  In-Reply-To: <7614.1579043019@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox