In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly talks about "what is the Tuplesortstate data structure in PostgreSQL". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what the Tuplesortstate data structure in PostgreSQL is like"!
Tuplesortstate
The private state of the Tuplesort operation.
/ * Possible states of a Tuplesort object. These denote the states that * persist between calls of Tuplesort routines. * the possible state of the Tuplesort object. * these indicate states that persist between calls to Tuplesort routines. * / typedef enum {/ / load tuple, TSS_INITIAL within memory limit, / * Loading tuples; still within memory limit * / / load tuple to TSS_BOUNDED in bounded heap, / * Loading tuples into bounded-size heap * / / load tuple, write to tape TSS_BUILDRUNS, / * Loading tuples Writing to tape * / / complete sorting TSS_SORTEDINMEM completely in memory, / * Sort completed entirely in memory * / / complete sorting, and finally execute sorting TSS_SORTEDONTAPE on tape, / * Sort completed, final run is on tape * / / do not perform final merge TSS_FINALMERGE / * Performing final merge on-the-fly * /} TupSortStatus / * * Parameters for calculation of number of tapes to use-see inittapes () * and tuplesort_merge_order (). * parameters used to calculate how many tapes are needed.-see inittapes () and tuplesort_merge_order () for details. * * In this calculation we assume that each tape will cost us about 1 blocks * worth of buffer space. This ignores the overhead of all the other data * structures needed for each tape, but it's probably close enough. * in this calculation, we assume that each tape consumes about one block of cache space. * although all other data structures that each tape depends on have been ignored, they are very close. * * MERGE_BUFFER_SIZE is how much data we'd like to read from each input * tape during a preread cycle (see discussion at top of file) * MERGE_BUFFER_SIZE indicates the size of the data we will read from each input taple in each read cycle * / # define MINORDER 6 / * minimum merge order * / # define MAXORDER 500 / * maximum merge order * / # define TAPE_BUFFER_OVERHEAD BLCKSZ#define MERGE_BUFFER_SIZE (BLCKSZ * 32) typedef int (* SortTupleComparator) (const SortTuple * a, const SortTuple * b) Tuplesortstate * state) / * Private state of a Tuplesort operation. * Private status of Tuplesort operation. * / struct Tuplesortstate {/ / status: for more information on enumerated values, please see the number of columns in TupSortStatus status; / * enumerated value as shown above * / / sort key. Int nKeys; / * number of columns in sort key * / / the caller needs random access? Bool randomAccess; / * did caller request random access? * / does the caller specify the maximum number of tuples returned? Bool bounded; / * did caller specify a maximum number of * tuples to return? * / / if bounded heap is used, return T bool boundUsed; / * true if we made use of a bounded heap * / if bounded heap is used, the maximum number of tuples int bound is stored here Can I configure / * if bounded, the maximum number of tuples * / / SortTuple.tuple? Bool tuples; / * Can SortTuple.tuple ever be set? * / / remaining available memory size (in bytes) int64 availMem; / * remaining memory available, in bytes * / Total allowed memory size (in bytes) int64 allowedMem; / * total memory allowed, in bytes * / / tapes number int maxTapes / * number of tapes (Knuth's T) * / / number of tapes-1 int tapeRange; / * maxTapes-1 (Knuth's P) * / / memory context MemoryContext sortcontext; / * memory context holding most sort data * / subcontext MemoryContext tuplecontext of sortcontext for tuple data mainly used to sort data / * sub-context of sortcontext for tuple data * / / the logtape.c object LogicalTapeSet * tapeset; / * logtape.c object for tapes in a temp file * / / * * These function pointers decouple the routines that must know what kind * of tuple we are sorting from the routines that don't need to know it of tapes in the temporary file. * They are set up by the tuplesort_begin_xxx routines. * these function pointers will have to know which tuple routines to sort are decoupled from routines that do not need to know it. * * Function to compare two tuples; result is per qsort () convention, ie: * 0 according as ab. The API must match * qsort_arg_comparator. * compare the functions of two tuples, and the result is specified by each qsort (), for example: *
< 0, 0, >Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 228
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.