Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TUPLESORT_H
00021 #define TUPLESORT_H
00022
00023 #include "access/itup.h"
00024 #include "executor/tuptable.h"
00025 #include "fmgr.h"
00026 #include "utils/relcache.h"
00027
00028
00029
00030
00031
00032 typedef struct Tuplesortstate Tuplesortstate;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc,
00062 int nkeys, AttrNumber *attNums,
00063 Oid *sortOperators, Oid *sortCollations,
00064 bool *nullsFirstFlags,
00065 int workMem, bool randomAccess);
00066 extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc,
00067 Relation indexRel,
00068 int workMem, bool randomAccess);
00069 extern Tuplesortstate *tuplesort_begin_index_btree(Relation heapRel,
00070 Relation indexRel,
00071 bool enforceUnique,
00072 int workMem, bool randomAccess);
00073 extern Tuplesortstate *tuplesort_begin_index_hash(Relation heapRel,
00074 Relation indexRel,
00075 uint32 hash_mask,
00076 int workMem, bool randomAccess);
00077 extern Tuplesortstate *tuplesort_begin_datum(Oid datumType,
00078 Oid sortOperator, Oid sortCollation,
00079 bool nullsFirstFlag,
00080 int workMem, bool randomAccess);
00081
00082 extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound);
00083
00084 extern void tuplesort_puttupleslot(Tuplesortstate *state,
00085 TupleTableSlot *slot);
00086 extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup);
00087 extern void tuplesort_putindextuple(Tuplesortstate *state, IndexTuple tuple);
00088 extern void tuplesort_putdatum(Tuplesortstate *state, Datum val,
00089 bool isNull);
00090
00091 extern void tuplesort_performsort(Tuplesortstate *state);
00092
00093 extern bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward,
00094 TupleTableSlot *slot);
00095 extern HeapTuple tuplesort_getheaptuple(Tuplesortstate *state, bool forward,
00096 bool *should_free);
00097 extern IndexTuple tuplesort_getindextuple(Tuplesortstate *state, bool forward,
00098 bool *should_free);
00099 extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward,
00100 Datum *val, bool *isNull);
00101
00102 extern void tuplesort_end(Tuplesortstate *state);
00103
00104 extern void tuplesort_get_stats(Tuplesortstate *state,
00105 const char **sortMethod,
00106 const char **spaceType,
00107 long *spaceUsed);
00108
00109 extern int tuplesort_merge_order(long allowedMem);
00110
00111
00112
00113
00114
00115
00116
00117 extern void tuplesort_rescan(Tuplesortstate *state);
00118 extern void tuplesort_markpos(Tuplesortstate *state);
00119 extern void tuplesort_restorepos(Tuplesortstate *state);
00120
00121 #endif