From: Michael P. <mic...@gm...> - 2012-11-26 14:53:38
|
Performance numbers are necessary to prove the viability of this feature. Some simple tests like with a table with millions of rows would be enough. On Mon, Nov 26, 2012 at 8:42 PM, Ashutosh Bapat < ash...@en...> wrote: > Hi All, > PFA patch which enables pushing down the ORDER BY clause or sorting to the > Datanode/s through standard_planner(). > > This patch leverages the already existing merge sort mechanism for > RemoteQuery but now outside RemoteQuery using Sort plans. > > For a Sort plan it checks if all the expressions on which the result needs > to be sorted are shippable and that the underlying tree allows to push > ORDER BY to the Datanodes. If so, it includes the ORDER BY clause in the > query to be sent to the Datanodes. If the number of Datanodes which > participate in RemoteQuery is not 1, it adds a covering Sort node to merge > the results from the Datanodes, otherwise, there is no covering Sort plan. > > The merge sort mechanism treats every Datanode as a tape and prefetches > the results from the Datanode corresponding to a dwindling tape. This is > enabled by setting the node from where to pull the next row before calling > ExecProcNode on RemoteQueryState. > > The same mechanism is being used for Sort plan node under Group or Agg > nodes. > > The patch adds test xc_sort.sql for testing this functionality. It also > removes the now useless members sort and tuplesortstate from RemoteQuery > and RemoteQueryState resp. > -- Michael Paquier http://michael.otacoo.com |