mirror of
https://github.com/pgvector/pgvector.git
synced 2026-12-04 00:08:30 +00:00
Reordered code for IVFFlat index scan [skip ci]
This commit is contained in:
1 parent
31788074b2
commit
575667e222
2 files changed
+16
-16
No files matched your search
+12
-12
@@ -293,6 +293,12 @@ typedef struct IvfflatScanOpaqueData
|
||||
Datum value;
|
||||
MemoryContext tmpCtx;
|
||||
|
||||
/* Support functions */
|
||||
FmgrInfo *procinfo;
|
||||
FmgrInfo *normprocinfo;
|
||||
Oid collation;
|
||||
Datum (*distfunc) (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2);
|
||||
|
||||
/* Stream */
|
||||
#ifdef IVFFLAT_USE_READ_STREAM
|
||||
ReadStream *stream;
|
||||
@@ -300,22 +306,16 @@ typedef struct IvfflatScanOpaqueData
|
||||
BlockNumber lastContiguousPage;
|
||||
#endif
|
||||
|
||||
/* Sorting */
|
||||
/* Lists */
|
||||
IvfflatScanList *lists;
|
||||
int listsVisited;
|
||||
pairingheap *listsHeap;
|
||||
|
||||
/* Items */
|
||||
Tuplesortstate *sortstate;
|
||||
TupleDesc tupdesc;
|
||||
TupleTableSlot *vslot;
|
||||
TupleTableSlot *mslot;
|
||||
|
||||
/* Support functions */
|
||||
FmgrInfo *procinfo;
|
||||
FmgrInfo *normprocinfo;
|
||||
Oid collation;
|
||||
Datum (*distfunc) (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2);
|
||||
|
||||
/* Lists */
|
||||
pairingheap *listsHeap;
|
||||
int listsVisited;
|
||||
IvfflatScanList *lists;
|
||||
} IvfflatScanOpaqueData;
|
||||
|
||||
typedef IvfflatScanOpaqueData * IvfflatScanOpaque;
|
||||
|
||||
+4
-4
@@ -386,6 +386,10 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
||||
|
||||
oldCtx = MemoryContextSwitchTo(so->tmpCtx);
|
||||
|
||||
so->lists = palloc_array_checked(IvfflatScanList, maxProbes);
|
||||
so->listsVisited = 0;
|
||||
so->listsHeap = pairingheap_allocate(CompareLists, scan);
|
||||
|
||||
/* Create tuple description for sorting */
|
||||
so->tupdesc = CreateTemplateTupleDesc(2);
|
||||
TupleDescInitEntry(so->tupdesc, (AttrNumber) 1, "distance", FLOAT8OID, -1, 0);
|
||||
@@ -401,10 +405,6 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
||||
so->vslot = MakeSingleTupleTableSlot(so->tupdesc, &TTSOpsVirtual);
|
||||
so->mslot = MakeSingleTupleTableSlot(so->tupdesc, &TTSOpsMinimalTuple);
|
||||
|
||||
so->listsHeap = pairingheap_allocate(CompareLists, scan);
|
||||
so->listsVisited = 0;
|
||||
so->lists = palloc_array_checked(IvfflatScanList, maxProbes);
|
||||
|
||||
#ifdef IVFFLAT_USE_READ_STREAM
|
||||
so->stream = read_stream_begin_relation(READ_STREAM_DEFAULT, NULL, index, MAIN_FORKNUM, IvfflatReadStreamNextBlock, so, 0);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user