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

Commit10dd353

Browse files
Ekaterina SokolovaMarina Polyakova
Ekaterina Sokolova
authored and
Marina Polyakova
committed
Update RUM to PostgreSQL 18
1. Rename some definitions and structures due to conflicts after 8492feb98f6d2. Add vacuum argument due to e5b0b0ce15093. Update README according to the documentation4. Update Travis CI and other minor fixes
1 parent0dae718 commit10dd353

File tree

10 files changed

+136
-112
lines changed

10 files changed

+136
-112
lines changed

‎.travis.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ notifications:
2323
on_failure:always
2424

2525
env:
26+
-PG_VERSION=18
27+
-PG_VERSION=18 LEVEL=hardcore
2628
-PG_VERSION=17
2729
-PG_VERSION=17 LEVEL=hardcore
2830
-PG_VERSION=16
@@ -32,6 +34,4 @@ env:
3234
-PG_VERSION=14
3335
-PG_VERSION=14 LEVEL=hardcore
3436
-PG_VERSION=13
35-
-PG_VERSION=13 LEVEL=hardcore
3637
-PG_VERSION=12
37-
-PG_VERSION=12 LEVEL=hardcore

‎README.md‎

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,33 @@
88

99
##Introduction
1010

11-
The**rum** module providesanaccess method to work witha`RUM`index. It is based
12-
on the`GIN` access method's code.
11+
The**rum** module provides access method to work withthe`RUM`indexes. It is based
12+
on the`GIN` access method code.
1313

14-
A`GIN` index allows performing fast full-text search using`tsvector` and
15-
`tsquery` types. But full-text search with a GIN index has several problems:
14+
`GIN` index allows you to perform fast full-text search using`tsvector` and
15+
`tsquery` types. However, full-text search with`GIN` index has some performance
16+
issues because positional and other additional information is not stored.
1617

17-
- Slow ranking. It needs positional information about lexemes to do ranking. A`GIN`
18-
index doesn't store positions of lexemes. So after index scanning, we need an
19-
additional heap scan to retrieve lexeme positions.
20-
- Slow phrase search with a`GIN` index. This problem relates to the previous
21-
problem. It needs positional information to perform phrase search.
22-
- Slow ordering by timestamp. A`GIN` index can't store some related information
23-
in the index with lexemes. So it is necessary to perform an additional heap scan.
18+
`RUM` solves these issues by storing additional information in a posting tree.
19+
As compared to`GIN`,`RUM` index has the following benefits:
2420

25-
`RUM` solves these problems by storing additional information in a posting tree.
26-
For example, positional information of lexemes or timestamps. You can get an
27-
idea of`RUM` with the following diagram:
21+
- Faster ranking. Ranking requires positional information. And after the
22+
index scan we do not need an additional heap scan to retrieve lexeme positions
23+
because`RUM` index stores them.
24+
- Faster phrase search. This improvement is related to the previous one as
25+
phrase search also needs positional information.
26+
- Faster ordering by timestamp.`RUM` index stores additional information together
27+
with lexemes, so it is not necessary to perform a heap scan.
28+
- A possibility to perform depth-first search and therefore return first
29+
results immediately.
30+
31+
You can get an idea of`RUM` with the following diagram:
2832

2933
[![How RUM stores additional information](img/gin_rum.svg)](https://postgrespro.ru/docs/enterprise/current/rum?lang=en)
3034

31-
A drawback of`RUM` is that it has slower build and inserttimes than`GIN`.
35+
The drawback of`RUM` is that it has slower build and inserttime as compared to`GIN`
3236
This is because we need to store additional information besides keys and because
33-
`RUM`uses generic Write-Ahead Log (WAL) records.
37+
because`RUM`stores additional information together with keys and uses genericWAL records.
3438

3539
##License
3640

‎TODO‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
1. with naturalOrder=true make scan the rest to be consistent with seqscan [done]
22
2. add leftlink to data page to privide backward scan on index (<=| op) [done]
3-
3.Compression ofItemPointer foruse_alternative_order
3+
3. ItemPointercompressionforindexes with order_by_attach
44
4. Compression addInfo
55
5. Remove FROM_STRATEGY ugly magick [done]
66

‎src/rum.h‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ typedef struct RumPageOpaqueData
4646
BlockNumberrightlink;/* next page if any */
4747
OffsetNumbermaxoff;/* number entries on RUM_DATA page: number of
4848
* heap ItemPointers on RUM_DATA|RUM_LEAF page
49-
* or number ofPostingItems on RUM_DATA &
49+
* or number ofRumPostingItems on RUM_DATA &
5050
* ~RUM_LEAF page. On RUM_LIST page, number of
5151
* heap tuples. */
5252
OffsetNumberfreespace;
@@ -150,19 +150,19 @@ typedef struct RumMetaPageData
150150
* (which is InvalidBlockNumber/0) as well as from all normal item
151151
* pointers (which have item numbers in the range 1..MaxHeapTuplesPerPage).
152152
*/
153-
#defineItemPointerSetMin(p) \
153+
#defineRumItemPointerSetMin(p) \
154154
ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0)
155-
#defineItemPointerIsMin(p) \
155+
#defineRumItemPointerIsMin(p) \
156156
(RumItemPointerGetOffsetNumber(p) == (OffsetNumber)0 && \
157157
RumItemPointerGetBlockNumber(p) == (BlockNumber)0)
158-
#defineItemPointerSetMax(p) \
158+
#defineRumItemPointerSetMax(p) \
159159
ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xfffe)
160-
#defineItemPointerIsMax(p) \
160+
#defineRumItemPointerIsMax(p) \
161161
(RumItemPointerGetOffsetNumber(p) == (OffsetNumber)0xfffe && \
162162
RumItemPointerGetBlockNumber(p) == InvalidBlockNumber)
163163
#defineItemPointerSetLossyPage(p,b) \
164164
ItemPointerSet((p), (b), (OffsetNumber)0xffff)
165-
#defineItemPointerIsLossyPage(p) \
165+
#defineRumItemPointerIsLossyPage(p) \
166166
(RumItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \
167167
RumItemPointerGetBlockNumber(p) != InvalidBlockNumber)
168168

@@ -175,7 +175,7 @@ typedef struct RumItem
175175

176176
#defineRumItemSetMin(item) \
177177
do { \
178-
ItemPointerSetMin(&((item)->iptr)); \
178+
RumItemPointerSetMin(&((item)->iptr)); \
179179
(item)->addInfoIsNull = true; \
180180
(item)->addInfo = (Datum) 0; \
181181
} while (0)
@@ -188,12 +188,12 @@ typedef struct
188188
/* We use BlockIdData not BlockNumber to avoid padding space wastage */
189189
BlockIdDatachild_blkno;
190190
RumItemitem;
191-
}PostingItem;
191+
}RumPostingItem;
192192

193-
#definePostingItemGetBlockNumber(pointer) \
193+
#defineRumPostingItemGetBlockNumber(pointer) \
194194
BlockIdGetBlockNumber(&(pointer)->child_blkno)
195195

196-
#definePostingItemSetBlockNumber(pointer,blockNumber) \
196+
#defineRumPostingItemSetBlockNumber(pointer,blockNumber) \
197197
BlockIdSet(&((pointer)->child_blkno), (blockNumber))
198198

199199
/*
@@ -265,8 +265,8 @@ typedef signed char RumNullCategory;
265265
* Data (posting tree) pages
266266
*/
267267
/*
268-
* FIXME -- Currently RumItem is placed as a pages right bound andPostingItem
269-
* is placed as a non-leaf pages item. Both RumItem andPostingItem stores
268+
* FIXME -- Currently RumItem is placed as a pages right bound andRumPostingItem
269+
* is placed as a non-leaf pages item. Both RumItem andRumPostingItem stores
270270
* AddInfo as a raw Datum, which is bogus. It is fine for pass-by-value
271271
* attributes, but it isn't for pass-by-reference, which may have variable
272272
* length of data. This AddInfo is used only by order_by_attach indexes, so it
@@ -278,12 +278,12 @@ typedef signed char RumNullCategory;
278278
#defineRumDataPageGetData(page)\
279279
(PageGetContents(page) + MAXALIGN(sizeof(RumItem)))
280280
#defineRumDataPageGetItem(page,i)\
281-
(RumDataPageGetData(page) + ((i)-1) * sizeof(PostingItem))
281+
(RumDataPageGetData(page) + ((i)-1) * sizeof(RumPostingItem))
282282

283283
#defineRumDataPageGetFreeSpace(page)\
284284
(BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \
285285
- MAXALIGN(sizeof(RumItem))/* right bound */ \
286-
-RumPageGetOpaque(page)->maxoff*sizeof(PostingItem) \
286+
-RumPageGetOpaque(page)->maxoff*sizeof(RumPostingItem) \
287287
-MAXALIGN(sizeof(RumPageOpaqueData)))
288288

289289
#defineRumMaxLeafDataItems \
@@ -513,7 +513,7 @@ typedef struct RumBtreeData
513513
uint32nitem;
514514
uint32curitem;
515515

516-
PostingItempitem;
516+
RumPostingItempitem;
517517
}RumBtreeData;
518518

519519
externRumBtreeStack*rumPrepareFindLeafPage(RumBtreebtree,BlockNumberblkno);

‎src/rumbtree.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ rumReFindLeafPage(RumBtree btree, RumBtreeStack * stack)
102102
* item pointer is less than item pointer previous to rightmost.
103103
*/
104104
if (compareRumItem(btree->rumstate,btree->entryAttnum,
105-
&(((PostingItem*)RumDataPageGetItem(page,maxoff-1))->item),
105+
&(((RumPostingItem*)RumDataPageGetItem(page,maxoff-1))->item),
106106
&btree->items[btree->curitem]) >=0)
107107
{
108108
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp