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

Commit22a0840

Browse files
committed
allow to use pass-by-ref types as addinfo (except for ordering)
1 parentf97b644 commit22a0840

File tree

6 files changed

+419
-67
lines changed

6 files changed

+419
-67
lines changed

‎expected/text.out

Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,268 @@ SELECT * FROM test_text WHERE i>'abc' ORDER BY i;
4242
xyz
4343
(2 rows)
4444

45+
CREATE TABLE test_text_o AS SELECT id::text, t FROM tsts;
46+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
47+
id
48+
-----
49+
135
50+
16
51+
168
52+
232
53+
252
54+
354
55+
355
56+
371
57+
39
58+
(9 rows)
59+
60+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
61+
id
62+
-----
63+
406
64+
415
65+
428
66+
457
67+
458
68+
484
69+
496
70+
71
71+
(8 rows)
72+
73+
CREATE INDEX test_text_o_idx ON test_text_o USING rum
74+
(t rum_tsvector_addon_ops, id)
75+
WITH (attach = 'id', to = 't');
76+
RESET enable_indexscan;
77+
RESET enable_indexonlyscan;
78+
SET enable_bitmapscan=OFF;
79+
SET enable_seqscan = off;
80+
EXPLAIN (costs off)
81+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
82+
QUERY PLAN
83+
---------------------------------------------------------------------------------
84+
Sort
85+
Sort Key: id
86+
-> Index Scan using test_text_o_idx on test_text_o
87+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
88+
(4 rows)
89+
90+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
91+
id
92+
-----
93+
135
94+
16
95+
168
96+
232
97+
252
98+
354
99+
355
100+
371
101+
39
102+
(9 rows)
103+
104+
EXPLAIN (costs off)
105+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
106+
QUERY PLAN
107+
---------------------------------------------------------------------------------
108+
Sort
109+
Sort Key: id
110+
-> Index Scan using test_text_o_idx on test_text_o
111+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
112+
(4 rows)
113+
114+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
115+
id
116+
-----
117+
406
118+
415
119+
428
120+
457
121+
458
122+
484
123+
496
124+
71
125+
(8 rows)
126+
127+
CREATE TABLE test_text_a AS SELECT id::text, t FROM tsts;
128+
CREATE INDEX test_text_a_idx ON test_text_a USING rum
129+
(t rum_tsvector_addon_ops, id)
130+
WITH (attach = 'id', to = 't', order_by_attach='t');
131+
EXPLAIN (costs off)
132+
SELECT count(*) FROM test_text_a WHERE id < '400';
133+
QUERY PLAN
134+
-------------------------------------------------------
135+
Aggregate
136+
-> Index Scan using test_text_a_idx on test_text_a
137+
Index Cond: (id < '400'::text)
138+
(3 rows)
139+
140+
SELECT count(*) FROM test_text_a WHERE id < '400';
141+
count
142+
-------
143+
337
144+
(1 row)
145+
146+
EXPLAIN (costs off)
147+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
148+
QUERY PLAN
149+
---------------------------------------------------------------------------------
150+
Sort
151+
Sort Key: id
152+
-> Index Scan using test_text_a_idx on test_text_a
153+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
154+
(4 rows)
155+
156+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
157+
id
158+
-----
159+
135
160+
16
161+
168
162+
232
163+
252
164+
354
165+
355
166+
371
167+
39
168+
(9 rows)
169+
170+
EXPLAIN (costs off)
171+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
172+
QUERY PLAN
173+
---------------------------------------------------------------------------------
174+
Sort
175+
Sort Key: id
176+
-> Index Scan using test_text_a_idx on test_text_a
177+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
178+
(4 rows)
179+
180+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
181+
id
182+
-----
183+
406
184+
415
185+
428
186+
457
187+
458
188+
484
189+
496
190+
71
191+
(8 rows)
192+
193+
CREATE TABLE test_text_h_o AS SELECT id::text, t FROM tsts;
194+
CREATE INDEX test_text_h_o_idx ON test_text_h_o USING rum
195+
(t rum_tsvector_hash_addon_ops, id)
196+
WITH (attach = 'id', to = 't');
197+
EXPLAIN (costs off)
198+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
199+
QUERY PLAN
200+
---------------------------------------------------------------------------------
201+
Sort
202+
Sort Key: id
203+
-> Index Scan using test_text_h_o_idx on test_text_h_o
204+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
205+
(4 rows)
206+
207+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
208+
id
209+
-----
210+
135
211+
16
212+
168
213+
232
214+
252
215+
354
216+
355
217+
371
218+
39
219+
(9 rows)
220+
221+
EXPLAIN (costs off)
222+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
223+
QUERY PLAN
224+
---------------------------------------------------------------------------------
225+
Sort
226+
Sort Key: id
227+
-> Index Scan using test_text_h_o_idx on test_text_h_o
228+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
229+
(4 rows)
230+
231+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
232+
id
233+
-----
234+
406
235+
415
236+
428
237+
457
238+
458
239+
484
240+
496
241+
71
242+
(8 rows)
243+
244+
CREATE TABLE test_text_h_a AS SELECT id::text, t FROM tsts;
245+
CREATE INDEX test_text_h_a_idx ON test_text_h_a USING rum
246+
(t rum_tsvector_hash_addon_ops, id)
247+
WITH (attach = 'id', to = 't', order_by_attach='t');
248+
EXPLAIN (costs off)
249+
SELECT count(*) FROM test_text_h_a WHERE id < '400';
250+
QUERY PLAN
251+
-----------------------------------------------------------
252+
Aggregate
253+
-> Index Scan using test_text_h_a_idx on test_text_h_a
254+
Index Cond: (id < '400'::text)
255+
(3 rows)
256+
257+
SELECT count(*) FROM test_text_h_a WHERE id < '400';
258+
count
259+
-------
260+
337
261+
(1 row)
262+
263+
EXPLAIN (costs off)
264+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
265+
QUERY PLAN
266+
---------------------------------------------------------------------------------
267+
Sort
268+
Sort Key: id
269+
-> Index Scan using test_text_h_a_idx on test_text_h_a
270+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
271+
(4 rows)
272+
273+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
274+
id
275+
-----
276+
135
277+
16
278+
168
279+
232
280+
252
281+
354
282+
355
283+
371
284+
39
285+
(9 rows)
286+
287+
EXPLAIN (costs off)
288+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
289+
QUERY PLAN
290+
---------------------------------------------------------------------------------
291+
Sort
292+
Sort Key: id
293+
-> Index Scan using test_text_h_a_idx on test_text_h_a
294+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
295+
(4 rows)
296+
297+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
298+
id
299+
-----
300+
406
301+
415
302+
428
303+
457
304+
458
305+
484
306+
496
307+
71
308+
(8 rows)
309+

‎sql/text.sql

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,72 @@ SELECT * FROM test_text WHERE i<='abc' ORDER BY i;
1313
SELECT*FROM test_textWHERE i='abc'ORDER BY i;
1414
SELECT*FROM test_textWHERE i>='abc'ORDER BY i;
1515
SELECT*FROM test_textWHERE i>'abc'ORDER BY i;
16+
17+
CREATETABLEtest_text_oASSELECT id::text, tFROM tsts;
18+
19+
SELECT idFROM test_text_oWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
20+
SELECT idFROM test_text_oWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
21+
22+
CREATEINDEXtest_text_o_idxON test_text_o USING rum
23+
(t rum_tsvector_addon_ops, id)
24+
WITH (attach='id', to='t');
25+
26+
RESET enable_indexscan;
27+
RESET enable_indexonlyscan;
28+
SET enable_bitmapscan=OFF;
29+
SET enable_seqscan= off;
30+
31+
EXPLAIN (costs off)
32+
SELECT idFROM test_text_oWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
33+
SELECT idFROM test_text_oWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
34+
EXPLAIN (costs off)
35+
SELECT idFROM test_text_oWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
36+
SELECT idFROM test_text_oWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
37+
38+
CREATETABLEtest_text_aASSELECT id::text, tFROM tsts;
39+
40+
CREATEINDEXtest_text_a_idxON test_text_a USING rum
41+
(t rum_tsvector_addon_ops, id)
42+
WITH (attach='id', to='t', order_by_attach='t');
43+
44+
EXPLAIN (costs off)
45+
SELECTcount(*)FROM test_text_aWHERE id<'400';
46+
SELECTcount(*)FROM test_text_aWHERE id<'400';
47+
48+
EXPLAIN (costs off)
49+
SELECT idFROM test_text_aWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
50+
SELECT idFROM test_text_aWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
51+
EXPLAIN (costs off)
52+
SELECT idFROM test_text_aWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
53+
SELECT idFROM test_text_aWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
54+
55+
CREATETABLEtest_text_h_oASSELECT id::text, tFROM tsts;
56+
57+
CREATEINDEXtest_text_h_o_idxON test_text_h_o USING rum
58+
(t rum_tsvector_hash_addon_ops, id)
59+
WITH (attach='id', to='t');
60+
61+
EXPLAIN (costs off)
62+
SELECT idFROM test_text_h_oWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
63+
SELECT idFROM test_text_h_oWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
64+
EXPLAIN (costs off)
65+
SELECT idFROM test_text_h_oWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
66+
SELECT idFROM test_text_h_oWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
67+
68+
CREATETABLEtest_text_h_aASSELECT id::text, tFROM tsts;
69+
70+
CREATEINDEXtest_text_h_a_idxON test_text_h_a USING rum
71+
(t rum_tsvector_hash_addon_ops, id)
72+
WITH (attach='id', to='t', order_by_attach='t');
73+
74+
EXPLAIN (costs off)
75+
SELECTcount(*)FROM test_text_h_aWHERE id<'400';
76+
SELECTcount(*)FROM test_text_h_aWHERE id<'400';
77+
78+
EXPLAIN (costs off)
79+
SELECT idFROM test_text_h_aWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
80+
SELECT idFROM test_text_h_aWHERE t @@'wr&qh'AND id<='400'ORDER BY id;
81+
EXPLAIN (costs off)
82+
SELECT idFROM test_text_h_aWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
83+
SELECT idFROM test_text_h_aWHERE t @@'wr&qh'AND id>='400'ORDER BY id;
84+

‎src/rum.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ typedef struct RumScanKeyData
619619
boolrecheckCurItem;
620620
boolisFinished;
621621
boolorderBy;
622+
boolwillSort;/* just a copy of RumScanOpaqueData.willSort */
622623
ScanDirectionscanDirection;
623624

624625
RumScanKey*addInfoKeys;
@@ -706,6 +707,7 @@ typedef struct RumScanOpaqueData
706707
RumKeykey;
707708
boolfirstCall;
708709
boolisVoidRes;/* true if query is unsatisfiable */
710+
boolwillSort;
709711
RumScanTypescanType;
710712
TIDBitmap*tbm;
711713

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp