mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Minor cleanup of the BRIN parallel build code
Commit b437571714 added support for parallel builds for BRIN indexes,
using code similar to BTREE parallel builds, and also a new tuplesort
variant. This commit simplifies the new code in two ways:
* The "spool" grouping tuplesort and the heap/index is not necessary.
The heap/index are available as separate arguments, causing confusion.
So remove the spool, and use the tuplesort directly.
* The new tuplesort variant does not need the heap/index, as it sorts
simply by the range block number, without accessing the tuple data.
So simplify that too.
Initial report and patch by Ranier Vilela, further cleanup by me.
Author: Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAqD7f2i4iyEaAz-5o-bf6zXVX-AkNUBm-YjUXEemaEh6A%40mail.gmail.com
This commit is contained in:
@@ -137,16 +137,6 @@ typedef struct
|
||||
uint32 max_buckets;
|
||||
} TuplesortIndexHashArg;
|
||||
|
||||
/*
|
||||
* Data struture pointed by "TuplesortPublic.arg" for the index_brin subcase.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
TuplesortIndexArg index;
|
||||
|
||||
/* XXX do we need something here? */
|
||||
} TuplesortIndexBrinArg;
|
||||
|
||||
/*
|
||||
* Data struture pointed by "TuplesortPublic.arg" for the Datum case.
|
||||
* Set by tuplesort_begin_datum and used only by the DatumTuple routines.
|
||||
@@ -562,20 +552,13 @@ tuplesort_begin_index_gist(Relation heapRel,
|
||||
}
|
||||
|
||||
Tuplesortstate *
|
||||
tuplesort_begin_index_brin(Relation heapRel,
|
||||
Relation indexRel,
|
||||
int workMem,
|
||||
tuplesort_begin_index_brin(int workMem,
|
||||
SortCoordinate coordinate,
|
||||
int sortopt)
|
||||
{
|
||||
Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
|
||||
sortopt);
|
||||
TuplesortPublic *base = TuplesortstateGetPublic(state);
|
||||
MemoryContext oldcontext;
|
||||
TuplesortIndexBrinArg *arg;
|
||||
|
||||
oldcontext = MemoryContextSwitchTo(base->maincontext);
|
||||
arg = (TuplesortIndexBrinArg *) palloc(sizeof(TuplesortIndexBrinArg));
|
||||
|
||||
#ifdef TRACE_SORT
|
||||
if (trace_sort)
|
||||
@@ -592,12 +575,7 @@ tuplesort_begin_index_brin(Relation heapRel,
|
||||
base->writetup = writetup_index_brin;
|
||||
base->readtup = readtup_index_brin;
|
||||
base->haveDatum1 = true;
|
||||
base->arg = arg;
|
||||
|
||||
arg->index.heapRel = heapRel;
|
||||
arg->index.indexRel = indexRel;
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
base->arg = NULL;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user