mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Propagate sort instrumentation from workers back to leader.
Up until now, when parallel query was used, no details about the sort method or space used by the workers were available; details were shown only for any sorting done by the leader. Fix that. Commit1177ab1dabforced the test case added by commit1f6d515a67to run without parallelism; now that we have this infrastructure, allow that again, with a little tweaking to make it pass with and without force_parallel_mode. Robert Haas and Tom Lane Discussion: http://postgr.es/m/CA+Tgmoa2VBZW6S8AAXfhpHczb=Rf6RqQ2br+zJvEgwJ0uoD_tQ@mail.gmail.com
This commit is contained in:
@@ -31,6 +31,34 @@
|
||||
*/
|
||||
typedef struct Tuplesortstate Tuplesortstate;
|
||||
|
||||
/*
|
||||
* Data structures for reporting sort statistics. Note that
|
||||
* TuplesortInstrumentation can't contain any pointers because we
|
||||
* sometimes put it in shared memory.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SORT_TYPE_STILL_IN_PROGRESS = 0,
|
||||
SORT_TYPE_TOP_N_HEAPSORT,
|
||||
SORT_TYPE_QUICKSORT,
|
||||
SORT_TYPE_EXTERNAL_SORT,
|
||||
SORT_TYPE_EXTERNAL_MERGE
|
||||
} TuplesortMethod;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SORT_SPACE_TYPE_DISK,
|
||||
SORT_SPACE_TYPE_MEMORY
|
||||
} TuplesortSpaceType;
|
||||
|
||||
typedef struct TuplesortInstrumentation
|
||||
{
|
||||
TuplesortMethod sortMethod; /* sort algorithm used */
|
||||
TuplesortSpaceType spaceType; /* type of space spaceUsed represents */
|
||||
long spaceUsed; /* space consumption, in kB */
|
||||
} TuplesortInstrumentation;
|
||||
|
||||
|
||||
/*
|
||||
* We provide multiple interfaces to what is essentially the same code,
|
||||
* since different callers have different data to be sorted and want to
|
||||
@@ -107,9 +135,9 @@ extern bool tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples,
|
||||
extern void tuplesort_end(Tuplesortstate *state);
|
||||
|
||||
extern void tuplesort_get_stats(Tuplesortstate *state,
|
||||
const char **sortMethod,
|
||||
const char **spaceType,
|
||||
long *spaceUsed);
|
||||
TuplesortInstrumentation *stats);
|
||||
extern const char *tuplesort_method_name(TuplesortMethod m);
|
||||
extern const char *tuplesort_space_type_name(TuplesortSpaceType t);
|
||||
|
||||
extern int tuplesort_merge_order(int64 allowedMem);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user