Re: Avoid full GIN index scan when possible

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Marc Cousin <cousinmarc(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: Avoid full GIN index scan when possible
Date: 2019-12-26 01:59:48
Message-ID: CAPpHfdvT_t6ShG2pvptEWceDxEnyNRsm2MxmCWWvxBzQ-pbMuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 25, 2019 at 8:25 AM Alexander Korotkov <
a(dot)korotkov(at)postgrespro(dot)ru> wrote:

> Patch requires further polishing including comments, minor refactoring
> etc. I'm going to continue work on this.
>

I also run the same performance comparison as Nikita [1] on my laptop.
The results are shown below. PostgreSQL was built with -O2 and
asserts enabled.

| Query time, ms |
WHERE condition | master | patch |
---------------------------------------+--------+-------+
a @> '{}' | 117 | 116 |
a @> '{}' and b @> '{}' | 150 | 146 |
a @> '{}' and b @> '{}' and c @> '{}' | 168 | 167 |
a @> '{}' and a @@ '1' | 126 | 0.6 |
a @> '{}' and a @@ '-1' | 128 | 3.2 |
a @@ '!-1' and a @@ '1' | 127 | 0.7 |
a @@ '!1' and a @@ '-1' | 122 | 4.4 |

Performance effect looks similar to patch #4 by Nikita. I've tried to
add patch #4 to comparison, but I've catch assertion failure.

TRAP: FailedAssertion("key->includeNonMatching", File: "ginget.c", Line:
1340)

I'm going to continue polishing my version of patch.

Links
1.
https://www.postgresql.org/message-id/f2889144-db1d-e3b2-db97-cfc8794cda43%40postgrespro.ru

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takuma Hoshiai 2019-12-26 02:03:02 Re: Implementing Incremental View Maintenance
Previous Message Amit Langote 2019-12-26 01:41:08 Re: unsupportable composite type partition keys