PostgreSQL Source Code git master
|
#include "access/brin_tuple.h"
#include "access/itup.h"
#include "executor/tuptable.h"
#include "storage/dsm.h"
#include "utils/logtape.h"
#include "utils/relcache.h"
#include "utils/sortsupport.h"
Go to the source code of this file.
Data Structures | |
struct | SortCoordinateData |
struct | TuplesortInstrumentation |
struct | SortTuple |
struct | TuplesortPublic |
Macros | |
#define | NUM_TUPLESORTMETHODS 4 |
#define | TUPLESORT_NONE 0 |
#define | TUPLESORT_RANDOMACCESS (1 << 0) |
#define | TUPLESORT_ALLOWBOUNDED (1 << 1) |
#define | TupleSortUseBumpTupleCxt(opt) (((opt) & TUPLESORT_ALLOWBOUNDED) == 0) |
#define | PARALLEL_SORT(coordinate) |
#define | TuplesortstateGetPublic(state) ((TuplesortPublic *) state) |
#define | LogicalTapeReadExact(tape, ptr, len) |
Typedefs | |
typedef struct Tuplesortstate | Tuplesortstate |
typedef struct Sharedsort | Sharedsort |
typedef struct SortCoordinateData | SortCoordinateData |
typedef struct SortCoordinateData * | SortCoordinate |
typedef struct TuplesortInstrumentation | TuplesortInstrumentation |
typedef int(* | SortTupleComparator) (const SortTuple *a, const SortTuple *b, Tuplesortstate *state) |
Enumerations | |
enum | TuplesortMethod { SORT_TYPE_STILL_IN_PROGRESS = 0 , SORT_TYPE_TOP_N_HEAPSORT = 1 << 0 , SORT_TYPE_QUICKSORT = 1 << 1 , SORT_TYPE_EXTERNAL_SORT = 1 << 2 , SORT_TYPE_EXTERNAL_MERGE = 1 << 3 } |
enum | TuplesortSpaceType { SORT_SPACE_TYPE_DISK , SORT_SPACE_TYPE_MEMORY } |
#define LogicalTapeReadExact | ( | tape, | |
ptr, | |||
len | |||
) |
Definition at line 262 of file tuplesort.h.
#define NUM_TUPLESORTMETHODS 4 |
Definition at line 84 of file tuplesort.h.
#define PARALLEL_SORT | ( | coordinate | ) |
Definition at line 255 of file tuplesort.h.
#define TUPLESORT_ALLOWBOUNDED (1 << 1) |
Definition at line 99 of file tuplesort.h.
#define TUPLESORT_NONE 0 |
Definition at line 93 of file tuplesort.h.
#define TUPLESORT_RANDOMACCESS (1 << 0) |
Definition at line 96 of file tuplesort.h.
#define TuplesortstateGetPublic | ( | state | ) | ((TuplesortPublic *) state) |
Definition at line 259 of file tuplesort.h.
#define TupleSortUseBumpTupleCxt | ( | opt | ) | (((opt) & TUPLESORT_ALLOWBOUNDED) == 0) |
Definition at line 108 of file tuplesort.h.
typedef struct Sharedsort Sharedsort |
Definition at line 38 of file tuplesort.h.
typedef struct SortCoordinateData* SortCoordinate |
Definition at line 61 of file tuplesort.h.
typedef struct SortCoordinateData SortCoordinateData |
Definition at line 155 of file tuplesort.h.
typedef struct TuplesortInstrumentation TuplesortInstrumentation |
typedef struct Tuplesortstate Tuplesortstate |
Definition at line 37 of file tuplesort.h.
enum TuplesortMethod |
Enumerator | |
---|---|
SORT_TYPE_STILL_IN_PROGRESS | |
SORT_TYPE_TOP_N_HEAPSORT | |
SORT_TYPE_QUICKSORT | |
SORT_TYPE_EXTERNAL_SORT | |
SORT_TYPE_EXTERNAL_MERGE |
Definition at line 75 of file tuplesort.h.
enum TuplesortSpaceType |
Enumerator | |
---|---|
SORT_SPACE_TYPE_DISK | |
SORT_SPACE_TYPE_MEMORY |
Definition at line 86 of file tuplesort.h.
void tuplesort_attach_shared | ( | Sharedsort * | shared, |
dsm_segment * | seg | ||
) |
Definition at line 2961 of file tuplesort.c.
References Sharedsort::fileset, and SharedFileSetAttach().
Referenced by _brin_parallel_build_main(), and _bt_parallel_build_main().
Tuplesortstate * tuplesort_begin_cluster | ( | TupleDesc | tupDesc, |
Relation | indexRel, | ||
int | workMem, | ||
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 241 of file tuplesortvariants.c.
References _bt_mkscankey(), SortSupportData::abbreviate, arg, TuplesortPublic::arg, Assert, BTGreaterStrategyNumber, BTLessStrategyNumber, BuildIndexInfo(), CLUSTER_SORT, TuplesortPublic::comparetup, comparetup_cluster(), comparetup_cluster_tiebreak(), TuplesortPublic::comparetup_tiebreak, CreateExecutorState(), CurrentMemoryContext, ExprContext::ecxt_scantuple, elog, TuplesortPublic::freestate, freestate_cluster(), GetPerTupleExprContext, TuplesortPublic::haveDatum1, i, IndexRelationGetNumberOfKeyAttributes, LOG, TuplesortPublic::maincontext, MakeSingleTupleTableSlot(), MemoryContextSwitchTo(), TuplesortPublic::nKeys, palloc0(), PARALLEL_SORT, pfree(), PrepareSortSupportFromIndexRel(), RelationData::rd_rel, TuplesortPublic::readtup, readtup_cluster(), RelationGetNumberOfAttributes, TuplesortPublic::removeabbrev, removeabbrev_cluster(), BTScanInsertData::scankeys, ScanKeyData::sk_attno, SK_BT_DESC, SK_BT_NULLS_FIRST, ScanKeyData::sk_collation, ScanKeyData::sk_flags, TuplesortPublic::sortKeys, SortSupportData::ssup_attno, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, trace_sort, TTSOpsHeapTuple, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_cluster().
Referenced by heapam_relation_copy_for_cluster().
Tuplesortstate * tuplesort_begin_common | ( | int | workMem, |
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 642 of file tuplesort.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, CurrentMemoryContext, elog, ERROR, INITIAL_MEMTUPSIZE, SortCoordinateData::isWorker, Max, MemoryContextSwitchTo(), SortCoordinateData::nParticipants, palloc0(), pg_rusage_init(), SortCoordinateData::sharedsort, trace_sort, tuplesort_begin_batch(), TUPLESORT_RANDOMACCESS, and worker_get_identifier().
Referenced by tuplesort_begin_cluster(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_begin_index_brin(), tuplesort_begin_index_btree(), tuplesort_begin_index_gist(), and tuplesort_begin_index_hash().
Tuplesortstate * tuplesort_begin_datum | ( | Oid | datumType, |
Oid | sortOperator, | ||
Oid | sortCollation, | ||
bool | nullsFirstFlag, | ||
int | workMem, | ||
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 572 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, SortSupportData::abbreviate, arg, TuplesortPublic::arg, TuplesortPublic::comparetup, comparetup_datum(), comparetup_datum_tiebreak(), TuplesortPublic::comparetup_tiebreak, CurrentMemoryContext, DATUM_SORT, elog, get_typlenbyval(), TuplesortPublic::haveDatum1, LOG, TuplesortPublic::maincontext, MemoryContextSwitchTo(), TuplesortPublic::nKeys, TuplesortPublic::onlyKey, palloc(), palloc0(), PARALLEL_SORT, PrepareSortSupportFromOrderingOp(), TuplesortPublic::readtup, readtup_datum(), TuplesortPublic::removeabbrev, removeabbrev_datum(), TuplesortPublic::sortKeys, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, trace_sort, TuplesortPublic::tuples, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_datum().
Referenced by ExecSort(), initialize_aggregate(), ordered_set_startup(), and validate_index().
Tuplesortstate * tuplesort_begin_heap | ( | TupleDesc | tupDesc, |
int | nkeys, | ||
AttrNumber * | attNums, | ||
Oid * | sortOperators, | ||
Oid * | sortCollations, | ||
bool * | nullsFirstFlags, | ||
int | workMem, | ||
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 168 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, SortSupportData::abbreviate, TuplesortPublic::arg, Assert, TuplesortPublic::comparetup, comparetup_heap(), comparetup_heap_tiebreak(), TuplesortPublic::comparetup_tiebreak, CurrentMemoryContext, elog, TuplesortPublic::haveDatum1, HEAP_SORT, i, LOG, TuplesortPublic::maincontext, MemoryContextSwitchTo(), TuplesortPublic::nKeys, TuplesortPublic::onlyKey, palloc0(), PARALLEL_SORT, PrepareSortSupportFromOrderingOp(), TuplesortPublic::readtup, readtup_heap(), TuplesortPublic::removeabbrev, removeabbrev_heap(), TuplesortPublic::sortKeys, SortSupportData::ssup_attno, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, trace_sort, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_heap().
Referenced by ExecIncrementalSort(), ExecSort(), initialize_aggregate(), initialize_phase(), ordered_set_startup(), and switchToPresortedPrefixMode().
Tuplesortstate * tuplesort_begin_index_brin | ( | int | workMem, |
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 545 of file tuplesortvariants.c.
References TuplesortPublic::arg, TuplesortPublic::comparetup, comparetup_index_brin(), elog, TuplesortPublic::haveDatum1, LOG, TuplesortPublic::nKeys, TuplesortPublic::readtup, readtup_index_brin(), TuplesortPublic::removeabbrev, removeabbrev_index_brin(), trace_sort, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_index_brin().
Referenced by _brin_parallel_scan_and_build(), and brinbuild().
Tuplesortstate * tuplesort_begin_index_btree | ( | Relation | heapRel, |
Relation | indexRel, | ||
bool | enforceUnique, | ||
bool | uniqueNullsNotDistinct, | ||
int | workMem, | ||
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 348 of file tuplesortvariants.c.
References _bt_mkscankey(), SortSupportData::abbreviate, arg, TuplesortPublic::arg, Assert, BTGreaterStrategyNumber, BTLessStrategyNumber, TuplesortPublic::comparetup, comparetup_index_btree(), comparetup_index_btree_tiebreak(), TuplesortPublic::comparetup_tiebreak, CurrentMemoryContext, elog, TuplesortPublic::haveDatum1, i, INDEX_SORT, IndexRelationGetNumberOfKeyAttributes, LOG, TuplesortPublic::maincontext, MemoryContextSwitchTo(), TuplesortPublic::nKeys, palloc(), palloc0(), PARALLEL_SORT, pfree(), PrepareSortSupportFromIndexRel(), TuplesortPublic::readtup, readtup_index(), TuplesortPublic::removeabbrev, removeabbrev_index(), BTScanInsertData::scankeys, ScanKeyData::sk_attno, SK_BT_DESC, SK_BT_NULLS_FIRST, ScanKeyData::sk_collation, ScanKeyData::sk_flags, TuplesortPublic::sortKeys, SortSupportData::ssup_attno, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, trace_sort, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_index().
Referenced by _bt_parallel_scan_and_sort(), and _bt_spools_heapscan().
Tuplesortstate * tuplesort_begin_index_gist | ( | Relation | heapRel, |
Relation | indexRel, | ||
int | workMem, | ||
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 482 of file tuplesortvariants.c.
References SortSupportData::abbreviate, arg, TuplesortPublic::arg, Assert, TuplesortPublic::comparetup, comparetup_index_btree(), comparetup_index_btree_tiebreak(), TuplesortPublic::comparetup_tiebreak, CurrentMemoryContext, elog, TuplesortPublic::haveDatum1, i, IndexRelationGetNumberOfKeyAttributes, LOG, TuplesortPublic::maincontext, MemoryContextSwitchTo(), TuplesortPublic::nKeys, palloc(), palloc0(), PrepareSortSupportFromGistIndexRel(), RelationData::rd_indcollation, TuplesortPublic::readtup, readtup_index(), TuplesortPublic::removeabbrev, removeabbrev_index(), TuplesortPublic::sortKeys, SortSupportData::ssup_attno, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, trace_sort, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_index().
Referenced by gistbuild().
Tuplesortstate * tuplesort_begin_index_hash | ( | Relation | heapRel, |
Relation | indexRel, | ||
uint32 | high_mask, | ||
uint32 | low_mask, | ||
uint32 | max_buckets, | ||
int | workMem, | ||
SortCoordinate | coordinate, | ||
int | sortopt | ||
) |
Definition at line 431 of file tuplesortvariants.c.
References arg, TuplesortPublic::arg, TuplesortPublic::comparetup, comparetup_index_hash(), comparetup_index_hash_tiebreak(), TuplesortPublic::comparetup_tiebreak, elog, TuplesortPublic::haveDatum1, LOG, TuplesortPublic::maincontext, MemoryContextSwitchTo(), TuplesortPublic::nKeys, palloc(), TuplesortPublic::readtup, readtup_index(), TuplesortPublic::removeabbrev, removeabbrev_index(), trace_sort, tuplesort_begin_common(), TUPLESORT_RANDOMACCESS, TuplesortstateGetPublic, TuplesortPublic::writetup, and writetup_index().
Referenced by _h_spoolinit().
void tuplesort_end | ( | Tuplesortstate * | state | ) |
Definition at line 951 of file tuplesort.c.
References MemoryContextDelete(), and tuplesort_free().
Referenced by _brin_parallel_merge(), _brin_parallel_scan_and_build(), _bt_parallel_scan_and_sort(), _bt_spooldestroy(), _h_spooldestroy(), ExecEndAgg(), ExecEndIncrementalSort(), ExecEndSort(), ExecReScanAgg(), ExecReScanSort(), gistbuild(), heapam_relation_copy_for_cluster(), initialize_aggregate(), initialize_phase(), ordered_set_shutdown(), process_ordered_aggregate_multi(), process_ordered_aggregate_single(), and validate_index().
Size tuplesort_estimate_shared | ( | int | nWorkers | ) |
Definition at line 2917 of file tuplesort.c.
References add_size(), Assert, MAXALIGN, and mul_size().
Referenced by _brin_begin_parallel(), and _bt_begin_parallel().
void tuplesort_get_stats | ( | Tuplesortstate * | state, |
TuplesortInstrumentation * | stats | ||
) |
Definition at line 2499 of file tuplesort.c.
References SORT_SPACE_TYPE_DISK, SORT_SPACE_TYPE_MEMORY, SORT_TYPE_EXTERNAL_MERGE, SORT_TYPE_EXTERNAL_SORT, SORT_TYPE_QUICKSORT, SORT_TYPE_STILL_IN_PROGRESS, SORT_TYPE_TOP_N_HEAPSORT, TuplesortInstrumentation::sortMethod, TuplesortInstrumentation::spaceType, TuplesortInstrumentation::spaceUsed, TSS_FINALMERGE, TSS_SORTEDINMEM, TSS_SORTEDONTAPE, and tuplesort_updatemax().
Referenced by ExecSort(), instrumentSortedGroup(), and show_sort_info().
BrinTuple * tuplesort_getbrintuple | ( | Tuplesortstate * | state, |
Size * | len, | ||
bool | forward | ||
) |
Definition at line 956 of file tuplesortvariants.c.
References len, MemoryContextSwitchTo(), TuplesortPublic::sortcontext, BrinSortTuple::tuple, SortTuple::tuple, BrinSortTuple::tuplen, tuplesort_gettuple_common(), and TuplesortstateGetPublic.
Referenced by _brin_parallel_merge().
bool tuplesort_getdatum | ( | Tuplesortstate * | state, |
bool | forward, | ||
bool | copy, | ||
Datum * | val, | ||
bool * | isNull, | ||
Datum * | abbrev | ||
) |
Definition at line 1004 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, arg, TuplesortPublic::arg, datumCopy(), if(), MemoryContextSwitchTo(), PointerGetDatum(), TuplesortPublic::sortcontext, TuplesortPublic::sortKeys, TuplesortPublic::tuples, tuplesort_gettuple_common(), TuplesortstateGetPublic, and val.
Referenced by ExecSort(), heapam_index_validate_scan(), mode_final(), percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), percentile_disc_multi_final(), and process_ordered_aggregate_single().
HeapTuple tuplesort_getheaptuple | ( | Tuplesortstate * | state, |
bool | forward | ||
) |
Definition at line 914 of file tuplesortvariants.c.
References MemoryContextSwitchTo(), TuplesortPublic::sortcontext, SortTuple::tuple, tuplesort_gettuple_common(), and TuplesortstateGetPublic.
Referenced by heapam_relation_copy_for_cluster().
IndexTuple tuplesort_getindextuple | ( | Tuplesortstate * | state, |
bool | forward | ||
) |
Definition at line 935 of file tuplesortvariants.c.
References MemoryContextSwitchTo(), TuplesortPublic::sortcontext, SortTuple::tuple, tuplesort_gettuple_common(), and TuplesortstateGetPublic.
Referenced by _bt_load(), _h_indexbuild(), and gist_indexsortbuild().
bool tuplesort_gettuple_common | ( | Tuplesortstate * | state, |
bool | forward, | ||
SortTuple * | stup | ||
) |
Definition at line 1470 of file tuplesort.c.
References Assert, elog, ERROR, getlen(), LogicalTapeBackspace(), LogicalTapeClose(), mergereadnext(), READTUP, RELEASE_SLAB_SLOT, SortTuple::srctape, TSS_FINALMERGE, TSS_SORTEDINMEM, TSS_SORTEDONTAPE, SortTuple::tuple, tuplesort_heap_delete_top(), tuplesort_heap_replace_top(), TUPLESORT_RANDOMACCESS, and WORKER.
Referenced by tuplesort_getbrintuple(), tuplesort_getdatum(), tuplesort_getheaptuple(), tuplesort_getindextuple(), tuplesort_gettupleslot(), and tuplesort_skiptuples().
bool tuplesort_gettupleslot | ( | Tuplesortstate * | state, |
bool | forward, | ||
bool | copy, | ||
TupleTableSlot * | slot, | ||
Datum * | abbrev | ||
) |
Definition at line 876 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, SortTuple::datum1, ExecClearTuple(), ExecStoreMinimalTuple(), heap_copy_minimal_tuple(), MemoryContextSwitchTo(), TuplesortPublic::sortcontext, TuplesortPublic::sortKeys, SortTuple::tuple, tuplesort_gettuple_common(), and TuplesortstateGetPublic.
Referenced by ExecIncrementalSort(), ExecSort(), fetch_input_tuple(), hypothetical_dense_rank_final(), hypothetical_rank_common(), process_ordered_aggregate_multi(), and switchToPresortedPrefixMode().
void tuplesort_initialize_shared | ( | Sharedsort * | shared, |
int | nWorkers, | ||
dsm_segment * | seg | ||
) |
Definition at line 2938 of file tuplesort.c.
References Assert, Sharedsort::currentWorker, Sharedsort::fileset, TapeShare::firstblocknumber, i, Sharedsort::mutex, Sharedsort::nTapes, SharedFileSetInit(), SpinLockInit, Sharedsort::tapes, and Sharedsort::workersFinished.
Referenced by _brin_begin_parallel(), and _bt_begin_parallel().
void tuplesort_markpos | ( | Tuplesortstate * | state | ) |
Definition at line 2435 of file tuplesort.c.
References Assert, elog, ERROR, LogicalTapeTell(), MemoryContextSwitchTo(), TSS_SORTEDINMEM, TSS_SORTEDONTAPE, and TUPLESORT_RANDOMACCESS.
Referenced by ExecSortMarkPos().
int tuplesort_merge_order | ( | int64 | allowedMem | ) |
Definition at line 1778 of file tuplesort.c.
References Max, MAXORDER, MERGE_BUFFER_SIZE, Min, MINORDER, and TAPE_BUFFER_OVERHEAD.
Referenced by cost_tuplesort(), and inittapes().
const char * tuplesort_method_name | ( | TuplesortMethod | m | ) |
Definition at line 2543 of file tuplesort.c.
References SORT_TYPE_EXTERNAL_MERGE, SORT_TYPE_EXTERNAL_SORT, SORT_TYPE_QUICKSORT, SORT_TYPE_STILL_IN_PROGRESS, and SORT_TYPE_TOP_N_HEAPSORT.
Referenced by show_incremental_sort_group_info(), and show_sort_info().
void tuplesort_performsort | ( | Tuplesortstate * | state | ) |
Definition at line 1363 of file tuplesort.c.
References dumptuples(), elog, ERROR, inittapes(), leader_takeover_tapes(), LOG, MemoryContextSwitchTo(), mergeruns(), pg_rusage_show(), SERIAL, sort_bounded_heap(), trace_sort, TSS_BOUNDED, TSS_BUILDRUNS, TSS_FINALMERGE, TSS_INITIAL, TSS_SORTEDINMEM, TSS_SORTEDONTAPE, tuplesort_sort_memtuples(), WORKER, and worker_nomergeruns().
Referenced by _brin_parallel_merge(), _brin_parallel_scan_and_build(), _bt_leafbuild(), _bt_parallel_scan_and_sort(), _h_indexbuild(), ExecIncrementalSort(), ExecSort(), gistbuild(), heapam_relation_copy_for_cluster(), hypothetical_dense_rank_final(), hypothetical_rank_common(), initialize_phase(), mode_final(), percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), percentile_disc_multi_final(), process_ordered_aggregate_multi(), process_ordered_aggregate_single(), switchToPresortedPrefixMode(), and validate_index().
void tuplesort_putbrintuple | ( | Tuplesortstate * | state, |
BrinTuple * | tuple, | ||
Size | size | ||
) |
Definition at line 774 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, BRINSORTTUPLE_SIZE, BrinTuple::bt_blkno, SortTuple::datum1, GetMemoryChunkSpace(), SortTuple::isnull1, MAXALIGN, MemoryContextSwitchTo(), palloc(), size, TuplesortPublic::sortKeys, TuplesortPublic::sortopt, BrinSortTuple::tuple, SortTuple::tuple, TuplesortPublic::tuplecontext, BrinSortTuple::tuplen, tuplesort_puttuple_common(), TuplesortstateGetPublic, and TupleSortUseBumpTupleCxt.
Referenced by form_and_spill_tuple().
void tuplesort_putdatum | ( | Tuplesortstate * | state, |
Datum | val, | ||
bool | isNull | ||
) |
Definition at line 812 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, arg, TuplesortPublic::arg, datumCopy(), DatumGetPointer(), if(), MemoryContextSwitchTo(), TuplesortPublic::sortKeys, TuplesortPublic::tuplecontext, TuplesortPublic::tuples, tuplesort_puttuple_common(), TuplesortstateGetPublic, and val.
Referenced by ExecEvalAggOrderedTransDatum(), ExecSort(), ordered_set_transition(), and validate_index_callback().
void tuplesort_putheaptuple | ( | Tuplesortstate * | state, |
HeapTuple | tup | ||
) |
Definition at line 695 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, arg, TuplesortPublic::arg, SortTuple::datum1, GetMemoryChunkSpace(), TuplesortPublic::haveDatum1, heap_copytuple(), heap_getattr(), HEAPTUPLESIZE, SortTuple::isnull1, MAXALIGN, MemoryContextSwitchTo(), TuplesortPublic::sortKeys, TuplesortPublic::sortopt, HeapTupleData::t_len, SortTuple::tuple, TuplesortPublic::tuplecontext, tuplesort_puttuple_common(), TuplesortstateGetPublic, and TupleSortUseBumpTupleCxt.
Referenced by heapam_relation_copy_for_cluster().
void tuplesort_putindextuplevalues | ( | Tuplesortstate * | state, |
Relation | rel, | ||
ItemPointer | self, | ||
const Datum * | values, | ||
const bool * | isnull | ||
) |
Definition at line 738 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, arg, TuplesortPublic::arg, SortTuple::datum1, GetMemoryChunkSpace(), index_form_tuple_context(), index_getattr(), INDEX_SIZE_MASK, SortTuple::isnull1, MAXALIGN, RelationGetDescr, TuplesortPublic::sortKeys, TuplesortPublic::sortopt, IndexTupleData::t_info, IndexTupleData::t_tid, SortTuple::tuple, TuplesortPublic::tuplecontext, tuplesort_puttuple_common(), TuplesortstateGetPublic, TupleSortUseBumpTupleCxt, and values.
Referenced by _bt_spool(), _h_spool(), and gistSortedBuildCallback().
void tuplesort_puttuple_common | ( | Tuplesortstate * | state, |
SortTuple * | tuple, | ||
bool | useAbbrev, | ||
Size | tuplen | ||
) |
Definition at line 1169 of file tuplesort.c.
References Assert, CHECK_FOR_INTERRUPTS, COMPARETUP, consider_abort_common(), SortTuple::datum1, dumptuples(), elog, ERROR, free_sort_tuple(), grow_memtuples(), inittapes(), LACKMEM, LEADER, LOG, make_bounded_heap(), MemoryContextSwitchTo(), pg_rusage_show(), REMOVEABBREV, trace_sort, TSS_BOUNDED, TSS_BUILDRUNS, TSS_INITIAL, tuplesort_heap_replace_top(), and USEMEM.
Referenced by tuplesort_putbrintuple(), tuplesort_putdatum(), tuplesort_putheaptuple(), tuplesort_putindextuplevalues(), and tuplesort_puttupleslot().
void tuplesort_puttupleslot | ( | Tuplesortstate * | state, |
TupleTableSlot * | slot | ||
) |
Definition at line 655 of file tuplesortvariants.c.
References SortSupportData::abbrev_converter, TuplesortPublic::arg, ExecCopySlotMinimalTuple(), GetMemoryChunkSpace(), heap_getattr(), MAXALIGN, MemoryContextSwitchTo(), MINIMAL_TUPLE_OFFSET, TuplesortPublic::sortKeys, TuplesortPublic::sortopt, SortSupportData::ssup_attno, MinimalTupleData::t_len, TuplesortPublic::tuplecontext, tuplesort_puttuple_common(), TuplesortstateGetPublic, and TupleSortUseBumpTupleCxt.
Referenced by ExecEvalAggOrderedTransTuple(), ExecIncrementalSort(), ExecSort(), fetch_input_tuple(), hypothetical_dense_rank_final(), hypothetical_rank_common(), ordered_set_transition_multi(), and switchToPresortedPrefixMode().
void * tuplesort_readtup_alloc | ( | Tuplesortstate * | state, |
Size | tuplen | ||
) |
Definition at line 2883 of file tuplesort.c.
References Assert, buf, MemoryContextAlloc(), and SLAB_SLOT_SIZE.
Referenced by readtup_cluster(), readtup_datum(), readtup_heap(), readtup_index(), and readtup_index_brin().
void tuplesort_rescan | ( | Tuplesortstate * | state | ) |
Definition at line 2402 of file tuplesort.c.
References Assert, elog, ERROR, LogicalTapeRewindForRead(), MemoryContextSwitchTo(), TSS_SORTEDINMEM, TSS_SORTEDONTAPE, and TUPLESORT_RANDOMACCESS.
Referenced by ExecReScanSort(), mode_final(), percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), and percentile_disc_multi_final().
void tuplesort_reset | ( | Tuplesortstate * | state | ) |
Definition at line 1019 of file tuplesort.c.
References tuplesort_begin_batch(), tuplesort_free(), and tuplesort_updatemax().
Referenced by ExecIncrementalSort(), ExecReScanIncrementalSort(), and switchToPresortedPrefixMode().
void tuplesort_restorepos | ( | Tuplesortstate * | state | ) |
Definition at line 2466 of file tuplesort.c.
References Assert, elog, ERROR, LogicalTapeSeek(), MemoryContextSwitchTo(), TSS_SORTEDINMEM, TSS_SORTEDONTAPE, and TUPLESORT_RANDOMACCESS.
Referenced by ExecSortRestrPos().
void tuplesort_set_bound | ( | Tuplesortstate * | state, |
int64 | bound | ||
) |
Definition at line 838 of file tuplesort.c.
References Assert, LEADER, TSS_INITIAL, TUPLESORT_ALLOWBOUNDED, and WORKER.
Referenced by ExecIncrementalSort(), ExecSort(), and switchToPresortedPrefixMode().
bool tuplesort_skiptuples | ( | Tuplesortstate * | state, |
int64 | ntuples, | ||
bool | forward | ||
) |
Definition at line 1710 of file tuplesort.c.
References Assert, CHECK_FOR_INTERRUPTS, elog, ERROR, MemoryContextSwitchTo(), TSS_FINALMERGE, TSS_SORTEDINMEM, TSS_SORTEDONTAPE, tuplesort_gettuple_common(), and WORKER.
Referenced by percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), and percentile_disc_multi_final().
const char * tuplesort_space_type_name | ( | TuplesortSpaceType | t | ) |
Definition at line 2566 of file tuplesort.c.
References Assert, SORT_SPACE_TYPE_DISK, and SORT_SPACE_TYPE_MEMORY.
Referenced by show_incremental_sort_group_info(), and show_sort_info().
bool tuplesort_used_bound | ( | Tuplesortstate * | state | ) |
Definition at line 886 of file tuplesort.c.
Referenced by ExecIncrementalSort().