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

Commiteb27a2f

Browse files
df7cbmsdemlei
authored andcommitted
Support equality lookups
1 parentc5433d3 commiteb27a2f

File tree

5 files changed

+65
-4
lines changed

5 files changed

+65
-4
lines changed

‎expected/moc100.out‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
6565
Buffers: shared hit=114
6666
(4 rows)
6767

68+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
69+
SELECT * FROM moc100 WHERE coverage = '6/43225,43227';
70+
QUERY PLAN
71+
-------------------------------------------------------------------------------
72+
Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1)
73+
Filter: (coverage = '6/43225 43227'::smoc)
74+
Rows Removed by Filter: 100
75+
Buffers: shared hit=59
76+
(4 rows)
77+
78+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
79+
SELECT * FROM moc100 WHERE coverage = '0/';
80+
QUERY PLAN
81+
-------------------------------------------------------------------------------
82+
Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1)
83+
Filter: (coverage = '0/'::smoc)
84+
Rows Removed by Filter: 100
85+
Buffers: shared hit=59
86+
(4 rows)
87+
6888
SET enable_seqscan = off;
6989
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
7090
SELECT * FROM moc100 WHERE coverage && '4/0';
@@ -107,3 +127,30 @@ EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
107127
Buffers: shared hit=9
108128
(8 rows)
109129

130+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
131+
SELECT * FROM moc100 WHERE coverage = '6/43225,43227';
132+
QUERY PLAN
133+
------------------------------------------------------------------------------------------------------------
134+
Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1)
135+
Recheck Cond: (coverage = '6/43225 43227'::smoc)
136+
Rows Removed by Index Recheck: 28
137+
Heap Blocks: exact=3
138+
Buffers: shared hit=12
139+
-> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=29 loops=1)
140+
Index Cond: (coverage = '6/43225 43227'::smoc)
141+
Buffers: shared hit=3
142+
(8 rows)
143+
144+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
145+
SELECT * FROM moc100 WHERE coverage = '0/';
146+
QUERY PLAN
147+
-----------------------------------------------------------------------------------------------------------
148+
Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1)
149+
Recheck Cond: (coverage = '0/'::smoc)
150+
Heap Blocks: exact=1
151+
Buffers: shared hit=5
152+
-> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=1 loops=1)
153+
Index Cond: (coverage = '0/'::smoc)
154+
Buffers: shared hit=4
155+
(7 rows)
156+

‎moc.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ smoc_gin_extract_query(PG_FUNCTION_ARGS)
11151115
StrategyNumberst=PG_GETARG_UINT16(2);
11161116
int32*searchmode= (int32*)PG_GETARG_POINTER(6);
11171117

1118-
if (st==MOC_GIN_STRATEGY_SUBSET)
1118+
if (st==MOC_GIN_STRATEGY_SUBSET|| (st==MOC_GIN_STRATEGY_EQUAL&&moc_a->area==0))
11191119
*searchmode=GIN_SEARCH_MODE_INCLUDE_EMPTY;
11201120

11211121
PG_RETURN_DATUM(smoc_gin_extract_internal(moc_a,nkeys,MOC_GIN_ORDER));
@@ -1129,7 +1129,7 @@ smoc_gin_extract_query_fine(PG_FUNCTION_ARGS)
11291129
StrategyNumberst=PG_GETARG_UINT16(2);
11301130
int32*searchmode= (int32*)PG_GETARG_POINTER(6);
11311131

1132-
if (st==MOC_GIN_STRATEGY_SUBSET)
1132+
if (st==MOC_GIN_STRATEGY_SUBSET|| (st==MOC_GIN_STRATEGY_EQUAL&&moc_a->area==0))
11331133
*searchmode=GIN_SEARCH_MODE_INCLUDE_EMPTY;
11341134

11351135
PG_RETURN_DATUM(smoc_gin_extract_internal(moc_a,nkeys,MOC_GIN_ORDER_FINE));
@@ -1140,8 +1140,6 @@ smoc_gin_consistent(PG_FUNCTION_ARGS)
11401140
{
11411141
bool*check= (bool*)PG_GETARG_POINTER(0);
11421142
StrategyNumberst=PG_GETARG_UINT16(1);
1143-
//Smoc*moc_a = (Smoc *) PG_DETOAST_DATUM(PG_GETARG_DATUM(2));
1144-
//int32moc_a_end = VARSIZE(moc_a) - VARHDRSZ;
11451143
int32nkeys=PG_GETARG_INT32(3);
11461144
bool*recheck= (bool*)PG_GETARG_POINTER(5);
11471145

@@ -1166,6 +1164,7 @@ smoc_gin_consistent(PG_FUNCTION_ARGS)
11661164
PG_RETURN_BOOL(true);
11671165

11681166
caseMOC_GIN_STRATEGY_SUPERSET:
1167+
caseMOC_GIN_STRATEGY_EQUAL:
11691168
/* return true when all pixels are contained in the indexed value */
11701169
for (inti=0;i<nkeys;i++)
11711170
{

‎pgs_moc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,6 @@ next_interval(int32 a)
127127
#defineMOC_GIN_STRATEGY_INTERSECTS1
128128
#defineMOC_GIN_STRATEGY_SUBSET2
129129
#defineMOC_GIN_STRATEGY_SUPERSET3
130+
#defineMOC_GIN_STRATEGY_EQUAL4
130131

131132
#endif

‎pgs_moc_ops.sql.in‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ CREATE OPERATOR CLASS smoc_gin_ops
346346
OPERATOR 1 &&,
347347
OPERATOR 2 <@,
348348
OPERATOR 3 @>,
349+
OPERATOR 4 =,
349350
FUNCTION 1 btint4cmp (int4, int4),
350351
FUNCTION 2 smoc_gin_extract_value (smoc, internal, internal),
351352
FUNCTION 3 smoc_gin_extract_query (smoc, internal, int2, internal, internal, internal, internal),
@@ -359,6 +360,7 @@ CREATE OPERATOR CLASS smoc_gin_ops_fine
359360
OPERATOR 1 &&,
360361
OPERATOR 2 <@,
361362
OPERATOR 3 @>,
363+
OPERATOR 4 =,
362364
FUNCTION 1 btint4cmp (int4, int4),
363365
FUNCTION 2 smoc_gin_extract_value_fine (smoc, internal, internal),
364366
FUNCTION 3 smoc_gin_extract_query_fine (smoc, internal, int2, internal, internal, internal, internal),

‎sql/moc100.sql‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
118118
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
119119
SELECT*FROM moc100WHERE coverage &&'4/0';
120120

121+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
122+
SELECT*FROM moc100WHERE coverage='6/43225,43227';
123+
124+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
125+
SELECT*FROM moc100WHERE coverage='0/';
126+
121127
SET enable_seqscan= off;
122128

123129
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
@@ -128,3 +134,9 @@ EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
128134

129135
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
130136
SELECT*FROM moc100WHERE coverage @>'4/0';
137+
138+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
139+
SELECT*FROM moc100WHERE coverage='6/43225,43227';
140+
141+
EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF)
142+
SELECT*FROM moc100WHERE coverage='0/';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp