From 139007ea6881f0207b7e73cec498905b7696d9e2 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 22 Oct 2023 19:26:25 -0700 Subject: [PATCH] Disabled compression for index tuples with IVFFlat --- src/ivfbuild.c | 2 +- src/ivfflat.h | 1 + src/ivfinsert.c | 2 +- src/ivfutils.c | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ivfbuild.c b/src/ivfbuild.c index 15ba9aa..533eeb4 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -287,7 +287,7 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum) #else TupleTableSlot *slot = MakeSingleTupleTableSlot(buildstate->tupdesc); #endif - TupleDesc tupdesc = RelationGetDescr(index); + TupleDesc tupdesc = IvfflatTupleDesc(index); UpdateProgress(PROGRESS_CREATEIDX_SUBPHASE, PROGRESS_IVFFLAT_PHASE_LOAD); diff --git a/src/ivfflat.h b/src/ivfflat.h index 1eb35b0..3c86433 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -287,6 +287,7 @@ void IvfflatInitPage(Buffer buf, Page page); void IvfflatInitRegisterPage(Relation index, Buffer *buf, Page *page, GenericXLogState **state); void IvfflatInit(void); PGDLLEXPORT void IvfflatParallelBuildMain(dsm_segment *seg, shm_toc *toc); +TupleDesc IvfflatTupleDesc(Relation index); /* Index access methods */ IndexBuildResult *ivfflatbuild(Relation heap, Relation index, IndexInfo *indexInfo); diff --git a/src/ivfinsert.c b/src/ivfinsert.c index 103fe49..d46d879 100644 --- a/src/ivfinsert.c +++ b/src/ivfinsert.c @@ -94,7 +94,7 @@ InsertTuple(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, R originalInsertPage = insertPage; /* Form tuple */ - itup = index_form_tuple(RelationGetDescr(index), &value, isnull); + itup = index_form_tuple(IvfflatTupleDesc(index), &value, isnull); itup->t_tid = *heap_tid; /* Get tuple size */ diff --git a/src/ivfutils.c b/src/ivfutils.c index 7959a17..c02be74 100644 --- a/src/ivfutils.c +++ b/src/ivfutils.c @@ -238,3 +238,17 @@ IvfflatUpdateList(Relation index, ListInfo listInfo, UnlockReleaseBuffer(buf); } } + +/* + * Get the tuple descriptor + */ +TupleDesc +IvfflatTupleDesc(Relation index) +{ + TupleDesc tupdesc = RelationGetDescr(index); + + /* Prevent compression */ + TupleDescAttr(tupdesc, 0)->attstorage = TYPSTORAGE_PLAIN; + + return tupdesc; +}