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

Commit7577736

Browse files
committed
Cope with smaller-than-normal BLCKSZ setting in SPGiST indexes on text.
The original coding failed miserably for BLCKSZ of 4K or less, as reportedby Josh Kupershmidt. With the present design for text indexes, a giveninner tuple could have up to 256 labels (requiring either 3K or 4K bytesdepending on MAXALIGN), which means that we can't positively guarantee nofailures for smaller blocksizes. But we can at least make it behave sanelyso long as there are few enough labels to fit on a page. Considering thatbtree is also more prone to "index tuple too large" failures when BLCKSZ issmall, it's not clear that we should expend more work than this on thiscase.
1 parent0caa0d0 commit7577736

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/backend/access/spgist/spgtextproc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@
2929
* of size BLCKSZ.Rather than assuming we know the exact amount of overhead
3030
* imposed by page headers, tuple headers, etc, we leave 100 bytes for that
3131
* (the actual overhead should be no more than 56 bytes at this writing, so
32-
* there is slop in this number). The upshot is that the maximum safe prefix
33-
* length is this:
32+
* there is slop in this number). So we can safely create prefixes up to
33+
* BLCKSZ - 256 * 16 - 100 bytes long. Unfortunately, because 256 * 16 is
34+
* already 4K, there is no safe prefix length when BLCKSZ is less than 8K;
35+
* it is always possible to get "SPGiST inner tuple size exceeds maximum"
36+
* if there are too many distinct next-byte values at a given place in the
37+
* tree. Since use of nonstandard block sizes appears to be negligible in
38+
* the field, we just live with that fact for now, choosing a max prefix
39+
* size of 32 bytes when BLCKSZ is configured smaller than default.
3440
*/
35-
#defineSPGIST_MAX_PREFIX_LENGTH(BLCKSZ - 256 * 16 - 100)
41+
#defineSPGIST_MAX_PREFIX_LENGTHMax((int) (BLCKSZ - 256 * 16 - 100), 32)
3642

3743
/* Struct for sorting values in picksplit */
3844
typedefstructspgNodePtr

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp