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

Commitc5737c1

Browse files
committed
Merge branch 'master' of gitlab.postgrespro.ru:a.zakirov/rum into test_readme
2 parents0508b96 +bb89abc commitc5737c1

37 files changed

+2537
-142
lines changed

‎Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ OBJS = src/rumsort.o src/rum_ts_utils.o src/rumtsquery.o \
55
src/rumbtree.o src/rumbulk.o src/rumdatapage.o\
66
src/rumentrypage.o src/rumget.o src/ruminsert.o\
77
src/rumscan.o src/rumutil.o src/rumvacuum.o src/rumvalidate.o\
8-
src/btree_rum.o$(WIN32RES)
8+
src/btree_rum.osrc/rum_arr_utils.o$(WIN32RES)
99

1010
EXTENSION = rum
11-
DATA = rum--1.0.sql rum--1.0--1.1.sql rum--1.1.sql
11+
EXTVERSION = 1.2
12+
DATA = rum--1.0.sql
13+
DATA_updates = rum--1.0--1.1.sql rum--1.1--1.2.sql
14+
DATA_built = rum--$(EXTVERSION).sql$(DATA_updates)
1215
PGFILEDESC = "RUM index access method"
1316
INCLUDES = src/rum.h src/rumsort.h
1417

@@ -17,7 +20,7 @@ REGRESS = rum rum_hash ruminv timestamp orderby orderby_hash altorder \
1720
int2 int4 int8 float4 float8 money oid\
1821
time timetz date interval\
1922
macaddr inet cidr text varchar char bytea bit varbit\
20-
numeric
23+
numeric anyarray
2124

2225
LDFLAGS_SL +=$(filter -lm,$(LIBS))
2326

@@ -35,14 +38,15 @@ endif
3538
wal-check: temp-install
3639
$(prove_check)
3740

38-
all: rum--1.1.sql
41+
all: rum--$(EXTVERSION).sql
3942

40-
#9.6 requires 1.1 file but 10.0 could live with1.0 + 1.0-1.1 files
41-
rum--1.1.sql: rum--1.0.sql rum--1.0--1.1.sql
42-
catrum--1.0.sql rum--1.0--1.1.sql> rum--1.1.sql
43+
#9.6 requires 1.2 file but 10.0 could live withupdate files
44+
rum--$(EXTVERSION).sql:$(DATA)$(DATA_updates)
45+
cat$(DATA)$(DATA_updates)> rum--$(EXTVERSION).sql
4346

44-
rum--1.0--1.1.sql: Makefile gen_rum_sql--1.0--1.1.pl
45-
perl gen_rum_sql--1.0--1.1.pl> rum--1.0--1.1.sql
47+
# rule for updates, e.g. rum--1.0--1.1.sql
48+
rum--%.sql: gen_rum_sql--%.pl
49+
perl$<>$@
4650

4751
install: installincludes
4852

‎expected/anyarray.out

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
set enable_seqscan=off;
2+
SET enable_bitmapscan=OFF;
3+
CREATE TABLE test_anyarray(
4+
i int[]
5+
);
6+
INSERT INTO test_anyarray
7+
SELECT ARRAY[1, x, x + 1] FROM generate_series(1, 10000) x;
8+
CREATE INDEX test_anyarray_idx ON test_anyarray USING rum (i);
9+
EXPLAIN (costs off)
10+
SELECT *, i <=> '{1}' FROM test_anyarray WHERE i % '{1}' ORDER BY i <=> '{1}' LIMIT 5;
11+
QUERY PLAN
12+
-----------------------------------------------------------
13+
Limit
14+
-> Index Scan using test_anyarray_idx on test_anyarray
15+
Index Cond: (i % '{1}'::integer[])
16+
Order By: (i <=> '{1}'::integer[])
17+
(4 rows)
18+
19+
SELECT *, i <=> '{1}' FROM test_anyarray WHERE i % '{1}' ORDER BY i <=> '{1}' LIMIT 5;
20+
i | ?column?
21+
---------+------------------
22+
{1,1,2} | 1.4142135623731
23+
{1,2,3} | 1.73205080756888
24+
{1,3,4} | 1.73205080756888
25+
{1,4,5} | 1.73205080756888
26+
{1,5,6} | 1.73205080756888
27+
(5 rows)
28+
29+
EXPLAIN (costs off)
30+
SELECT *, i <=> '{1}' FROM test_anyarray WHERE i @> '{1}' ORDER BY i <=> '{1}' LIMIT 5;
31+
QUERY PLAN
32+
-----------------------------------------------------------
33+
Limit
34+
-> Index Scan using test_anyarray_idx on test_anyarray
35+
Index Cond: (i @> '{1}'::integer[])
36+
Order By: (i <=> '{1}'::integer[])
37+
(4 rows)
38+
39+
SELECT *, i <=> '{1}' FROM test_anyarray WHERE i @> '{1}' ORDER BY i <=> '{1}' LIMIT 5;
40+
i | ?column?
41+
---------+------------------
42+
{1,1,2} | 1.4142135623731
43+
{1,2,3} | 1.73205080756888
44+
{1,3,4} | 1.73205080756888
45+
{1,4,5} | 1.73205080756888
46+
{1,5,6} | 1.73205080756888
47+
(5 rows)
48+
49+
EXPLAIN (costs off)
50+
SELECT *, i <=> '{1}' FROM test_anyarray WHERE i % '{1}' ORDER BY i <=> '{1}' LIMIT 5000;
51+
QUERY PLAN
52+
-----------------------------------------------------------
53+
Limit
54+
-> Index Scan using test_anyarray_idx on test_anyarray
55+
Index Cond: (i % '{1}'::integer[])
56+
Order By: (i <=> '{1}'::integer[])
57+
(4 rows)
58+
59+
CREATE TABLE test_anyarray_ts(
60+
i int[],
61+
d timestamp
62+
);
63+
INSERT INTO test_anyarray_ts VALUES
64+
( '{1,2,3}', '2004-10-26 03:55:08' ),
65+
( '{2,3,4}', '2004-10-26 04:55:08' ),
66+
( '{3,4,5}', '2004-10-26 05:55:08' ),
67+
( '{4,5,6}', '2004-10-26 08:55:08' ),
68+
( '{5,6,7}', '2004-10-26 09:55:08' ),
69+
( '{6,7,8}', '2004-10-26 10:55:08' )
70+
;
71+
CREATE INDEX test_anyarray_ts_idx ON test_anyarray_ts USING rum
72+
(i rum_anyarray_addon_ops, d)
73+
WITH (attach = 'd', to = 'i');
74+
EXPLAIN (costs off)
75+
SELECT *, d <=> '2004-10-26 08:00:00' FROM test_anyarray_ts WHERE i % '{3}' ORDER BY d <=> '2004-10-26 08:00:00' LIMIT 5;
76+
QUERY PLAN
77+
-----------------------------------------------------------------------------------
78+
Limit
79+
-> Index Scan using test_anyarray_ts_idx on test_anyarray_ts
80+
Order By: (d <=> 'Tue Oct 26 08:00:00 2004'::timestamp without time zone)
81+
Filter: (i % '{3}'::integer[])
82+
(4 rows)
83+
84+
SELECT *, d <=> '2004-10-26 08:00:00' FROM test_anyarray_ts WHERE i % '{3}' ORDER BY d <=> '2004-10-26 08:00:00' LIMIT 5;
85+
i | d | ?column?
86+
---------+--------------------------+----------
87+
{3,4,5} | Tue Oct 26 05:55:08 2004 | 7492
88+
{2,3,4} | Tue Oct 26 04:55:08 2004 | 11092
89+
{1,2,3} | Tue Oct 26 03:55:08 2004 | 14692
90+
(3 rows)
91+
92+
EXPLAIN (costs off)
93+
SELECT *, d <=> '2004-10-26 08:00:00' FROM test_anyarray_ts WHERE i @> '{3}' ORDER BY d <=> '2004-10-26 08:00:00' LIMIT 5;
94+
QUERY PLAN
95+
-----------------------------------------------------------------------------------
96+
Limit
97+
-> Index Scan using test_anyarray_ts_idx on test_anyarray_ts
98+
Index Cond: (i @> '{3}'::integer[])
99+
Order By: (d <=> 'Tue Oct 26 08:00:00 2004'::timestamp without time zone)
100+
(4 rows)
101+
102+
SELECT *, d <=> '2004-10-26 08:00:00' FROM test_anyarray_ts WHERE i @> '{3}' ORDER BY d <=> '2004-10-26 08:00:00' LIMIT 5;
103+
i | d | ?column?
104+
---------+--------------------------+----------
105+
{3,4,5} | Tue Oct 26 05:55:08 2004 | 7492
106+
{2,3,4} | Tue Oct 26 04:55:08 2004 | 11092
107+
{1,2,3} | Tue Oct 26 03:55:08 2004 | 14692
108+
(3 rows)
109+

‎expected/float4.out

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,39 @@ SELECT * FROM test_float4 WHERE i>1::float4 ORDER BY i;
4242
3
4343
(2 rows)
4444

45+
EXPLAIN (costs off)
46+
SELECT *, i <=> 0::float4 FROM test_float4 ORDER BY i <=> 0::float4;
47+
QUERY PLAN
48+
--------------------------------------------
49+
Index Scan using idx_float4 on test_float4
50+
Order By: (i <=> '0'::real)
51+
(2 rows)
52+
53+
SELECT *, i <=> 0::float4 FROM test_float4 ORDER BY i <=> 0::float4;
54+
i | ?column?
55+
----+----------
56+
0 | 0
57+
-1 | 1
58+
1 | 1
59+
-2 | 2
60+
2 | 2
61+
3 | 3
62+
(6 rows)
63+
64+
EXPLAIN (costs off)
65+
SELECT *, i <=> 1::float4 FROM test_float4 WHERE i<1::float4 ORDER BY i <=> 1::float4;
66+
QUERY PLAN
67+
--------------------------------------------
68+
Index Scan using idx_float4 on test_float4
69+
Index Cond: (i < '1'::real)
70+
Order By: (i <=> '1'::real)
71+
(3 rows)
72+
73+
SELECT *, i <=> 1::float4 FROM test_float4 WHERE i<1::float4 ORDER BY i <=> 1::float4;
74+
i | ?column?
75+
----+----------
76+
0 | 1
77+
-1 | 2
78+
-2 | 3
79+
(3 rows)
80+

‎expected/float8.out

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,39 @@ SELECT * FROM test_float8 WHERE i>1::float8 ORDER BY i;
4242
3
4343
(2 rows)
4444

45+
EXPLAIN (costs off)
46+
SELECT *, i <=> 0::float8 FROM test_float8 ORDER BY i <=> 0::float8;
47+
QUERY PLAN
48+
--------------------------------------------
49+
Index Scan using idx_float8 on test_float8
50+
Order By: (i <=> '0'::double precision)
51+
(2 rows)
52+
53+
SELECT *, i <=> 0::float8 FROM test_float8 ORDER BY i <=> 0::float8;
54+
i | ?column?
55+
----+----------
56+
0 | 0
57+
-1 | 1
58+
1 | 1
59+
-2 | 2
60+
2 | 2
61+
3 | 3
62+
(6 rows)
63+
64+
EXPLAIN (costs off)
65+
SELECT *, i <=> 1::float8 FROM test_float8 WHERE i<1::float8 ORDER BY i <=> 1::float8;
66+
QUERY PLAN
67+
--------------------------------------------
68+
Index Scan using idx_float8 on test_float8
69+
Index Cond: (i < '1'::double precision)
70+
Order By: (i <=> '1'::double precision)
71+
(3 rows)
72+
73+
SELECT *, i <=> 1::float8 FROM test_float8 WHERE i<1::float8 ORDER BY i <=> 1::float8;
74+
i | ?column?
75+
----+----------
76+
0 | 1
77+
-1 | 2
78+
-2 | 3
79+
(3 rows)
80+

‎expected/int2.out

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,39 @@ SELECT * FROM test_int2 WHERE i>1::int2 ORDER BY i;
4242
3
4343
(2 rows)
4444

45+
EXPLAIN (costs off)
46+
SELECT *, i <=> 0::int2 FROM test_int2 ORDER BY i <=> 0::int2;
47+
QUERY PLAN
48+
----------------------------------------
49+
Index Scan using idx_int2 on test_int2
50+
Order By: (i <=> '0'::smallint)
51+
(2 rows)
52+
53+
SELECT *, i <=> 0::int2 FROM test_int2 ORDER BY i <=> 0::int2;
54+
i | ?column?
55+
----+----------
56+
0 | 0
57+
-1 | 1
58+
1 | 1
59+
-2 | 2
60+
2 | 2
61+
3 | 3
62+
(6 rows)
63+
64+
EXPLAIN (costs off)
65+
SELECT *, i <=> 1::int2 FROM test_int2 WHERE i<1::int2 ORDER BY i <=> 1::int2;
66+
QUERY PLAN
67+
----------------------------------------
68+
Index Scan using idx_int2 on test_int2
69+
Index Cond: (i < '1'::smallint)
70+
Order By: (i <=> '1'::smallint)
71+
(3 rows)
72+
73+
SELECT *, i <=> 1::int2 FROM test_int2 WHERE i<1::int2 ORDER BY i <=> 1::int2;
74+
i | ?column?
75+
----+----------
76+
0 | 1
77+
-1 | 2
78+
-2 | 3
79+
(3 rows)
80+

‎expected/int4.out

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,42 @@ SELECT * FROM test_int4 WHERE i>1::int4 ORDER BY i;
4242
3
4343
(2 rows)
4444

45+
EXPLAIN (costs off)
46+
SELECT *, i <=> 0::int4 FROM test_int4 ORDER BY i <=> 0::int4;
47+
QUERY PLAN
48+
----------------------------------------
49+
Index Scan using idx_int4 on test_int4
50+
Order By: (i <=> 0)
51+
(2 rows)
52+
53+
SELECT *, i <=> 0::int4 FROM test_int4 ORDER BY i <=> 0::int4;
54+
i | ?column?
55+
----+----------
56+
0 | 0
57+
-1 | 1
58+
1 | 1
59+
-2 | 2
60+
2 | 2
61+
3 | 3
62+
(6 rows)
63+
64+
EXPLAIN (costs off)
65+
SELECT *, i <=> 1::int4 FROM test_int4 WHERE i<1::int4 ORDER BY i <=> 1::int4;
66+
QUERY PLAN
67+
----------------------------------------
68+
Index Scan using idx_int4 on test_int4
69+
Index Cond: (i < 1)
70+
Order By: (i <=> 1)
71+
(3 rows)
72+
73+
SELECT *, i <=> 1::int4 FROM test_int4 WHERE i<1::int4 ORDER BY i <=> 1::int4;
74+
i | ?column?
75+
----+----------
76+
0 | 1
77+
-1 | 2
78+
-2 | 3
79+
(3 rows)
80+
4581
CREATE TABLE test_int4_o AS SELECT id::int4, t FROM tsts;
4682
CREATE INDEX test_int4_o_idx ON test_int4_o USING rum
4783
(t rum_tsvector_addon_ops, id)
@@ -648,3 +684,30 @@ SELECT id FROM test_int4_h_a WHERE t @@ 'wr&qh' AND id >= 400 ORDER BY id;
648684
496
649685
(7 rows)
650686

687+
CREATE TABLE test_int4_id_t AS SELECT id::int4, t FROM tsts;
688+
CREATE INDEX test_int4_id_t_idx ON test_int4_o USING rum
689+
(t rum_tsvector_ops, id);
690+
EXPLAIN (costs off)
691+
SELECT id FROM test_int4_h_a WHERE t @@ 'wr&qh' AND id <= 400::int4 ORDER BY id <=> 400::int4;
692+
QUERY PLAN
693+
-------------------------------------------------------------------
694+
Index Scan using test_int4_h_a_idx on test_int4_h_a
695+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= 400))
696+
Order By: (id <=> 400)
697+
(3 rows)
698+
699+
SELECT id FROM test_int4_h_a WHERE t @@ 'wr&qh' AND id <= 400::int4 ORDER BY id <=> 400::int4;
700+
id
701+
-----
702+
371
703+
355
704+
354
705+
252
706+
232
707+
168
708+
135
709+
71
710+
39
711+
16
712+
(10 rows)
713+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp