summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorMason S2010-06-29 19:32:26 +0000
committerPavan Deolasee2011-05-19 16:45:11 +0000
commitad1681c9912300df66a81522d0091f292b6cd942 (patch)
tree0b0d0f08412842b2a7b84ba6d94676a1c40be6c2 /src/include/utils
parent66066d6f1c9a49916f5a5c479b1926e11e5c0098 (diff)
Add support for ORDER BY adn DISTINCT.
This is handled on the Coordinator. It will push down the ORDER BY and merge-sort the sorted input streams from the nodes. It converts from DataRow to tuple format as needed. If one of the SELECT clause expressions is not in the ORDER BY, it appends it to the ORDER BY when pushing it down to the data nodes and leaves it off when returning to the client. With DISTINCT, an ORDER BY will be used and pushed down to the data nodes such that a merge-sort can be done and de-duplication can occur. By Andrei Martsinchyk
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/tuplesort.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h
index e351536d47..e2b3c033e0 100644
--- a/src/include/utils/tuplesort.h
+++ b/src/include/utils/tuplesort.h
@@ -23,6 +23,9 @@
#include "access/itup.h"
#include "executor/tuptable.h"
#include "fmgr.h"
+#ifdef PGXC
+#include "pgxc/execRemote.h"
+#endif
#include "utils/relcache.h"
@@ -64,6 +67,13 @@ extern Tuplesortstate *tuplesort_begin_index_hash(Relation indexRel,
extern Tuplesortstate *tuplesort_begin_datum(Oid datumType,
Oid sortOperator, bool nullsFirstFlag,
int workMem, bool randomAccess);
+#ifdef PGXC
+extern Tuplesortstate *tuplesort_begin_merge(TupleDesc tupDesc,
+ int nkeys, AttrNumber *attNums,
+ Oid *sortOperators, bool *nullsFirstFlags,
+ RemoteQueryState *combiner,
+ int workMem);
+#endif
extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound);