Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20e7e1f

Browse files
committed
Remove <@ from contrib/intarray's GiST operator classes.
Since commitefc77cf, an indexed query using <@ has required afull-index scan, so that it actually performs worse than a plain seqscanwould do. As I noted at the time, we'd be better off to not treat <@ asbeing indexable by such indexes at all; and that's what this patch does.It would have been difficult to remove these opclass members withoutdropping the whole opclass before commit9f96827 fixed GiST opclassmember dependency rules, but now it's quite simple, so let's do it.I left the existing support code in place for the time being, withcomments noting it's now unreachable. At some point, perhaps we shouldremove that code in favor of throwing an error telling people to upgradethe extension version.Discussion:https://postgr.es/m/2176979.1596389859@sss.pgh.pa.usDiscussion:https://postgr.es/m/458.1565114141@sss.pgh.pa.us
1 parent39132b7 commit20e7e1f

File tree

6 files changed

+39
-4
lines changed

6 files changed

+39
-4
lines changed

‎contrib/intarray/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ OBJS = \
1212
_intbig_gist.o
1313

1414
EXTENSION = intarray
15-
DATA = intarray--1.2--1.3.sql intarray--1.2.sql intarray--1.1--1.2.sql\
15+
DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql\
16+
intarray--1.2.sql intarray--1.1--1.2.sql\
1617
intarray--1.0--1.1.sql
1718
PGFILEDESC = "intarray - functions and operators for arrays of integers"
1819

‎contrib/intarray/_int_gist.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ g_int_consistent(PG_FUNCTION_ARGS)
9393
break;
9494
caseRTContainedByStrategyNumber:
9595
caseRTOldContainedByStrategyNumber:
96+
97+
/*
98+
* This code is unreachable as of intarray 1.4, because the <@
99+
* operator has been removed from the opclass. We keep it for now
100+
* to support older versions of the SQL definitions.
101+
*/
96102
if (GIST_LEAF(entry))
97103
retval=inner_int_contains(query,
98104
(ArrayType*)DatumGetPointer(entry->key));

‎contrib/intarray/_intbig_gist.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,12 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
533533
break;
534534
caseRTContainedByStrategyNumber:
535535
caseRTOldContainedByStrategyNumber:
536+
537+
/*
538+
* This code is unreachable as of intarray 1.4, because the <@
539+
* operator has been removed from the opclass. We keep it for now
540+
* to support older versions of the SQL definitions.
541+
*/
536542
if (GIST_LEAF(entry))
537543
{
538544
inti,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* contrib/intarray/intarray--1.3--1.4.sql*/
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use"ALTER EXTENSION intarray UPDATE TO '1.4'" to load this file. \quit
5+
6+
-- Remove <@ from the GiST opclasses, as it's not usefully indexable
7+
-- due to mishandling of empty arrays. (It's OK in GIN.)
8+
9+
ALTEROPERATOR FAMILY gist__int_ops USING gist
10+
DROPOPERATOR8 (_int4, _int4);
11+
12+
ALTEROPERATOR FAMILY gist__intbig_ops USING gist
13+
DROPOPERATOR8 (_int4, _int4);
14+
15+
-- Likewise for the old spelling ~.
16+
17+
ALTEROPERATOR FAMILY gist__int_ops USING gist
18+
DROPOPERATOR14 (_int4, _int4);
19+
20+
ALTEROPERATOR FAMILY gist__intbig_ops USING gist
21+
DROPOPERATOR14 (_int4, _int4);

‎contrib/intarray/intarray.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# intarray extension
22
comment = 'functions, operators, and index support for 1-D arrays of integers'
3-
default_version = '1.3'
3+
default_version = '1.4'
44
module_pathname = '$libdir/_int'
55
relocatable = true
66
trusted = true

‎doc/src/sgml/intarray.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@
399399

400400
<para>
401401
<filename>intarray</filename> provides index support for the
402-
<literal>&amp;&amp;</literal>, <literal>@&gt;</literal>, <literal>&lt;@</literal>,
402+
<literal>&amp;&amp;</literal>, <literal>@&gt;</literal>,
403403
and <literal>@@</literal> operators, as well as regular array equality.
404404
</para>
405405

@@ -436,7 +436,8 @@
436436

437437
<para>
438438
There is also a non-default GIN operator class
439-
<literal>gin__int_ops</literal> supporting the same operators.
439+
<literal>gin__int_ops</literal>, which supports these operators as well
440+
as <literal>&lt;@</literal>.
440441
</para>
441442

442443
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp