Re: [HACKERS] [Proposal] Make the optimiser aware of partitions ordering - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [HACKERS] [Proposal] Make the optimiser aware of partitions ordering
Date
Msg-id CA+TgmoYLUWMF+ydZuAnLrR1Fc5VDxPOZfjiOmuf4wpkZ3_vdLw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] [Proposal] Make the optimiser aware of partitions ordering  (Julien Rouhaud <rjuju123@gmail.com>)
Responses Re: [HACKERS] [Proposal] Make the optimiser aware of partitions ordering  (Julien Rouhaud <rjuju123@gmail.com>)
List pgsql-hackers
On Fri, Sep 22, 2017 at 4:23 PM, Julien Rouhaud <rjuju123@gmail.com> wrote:
> That was one of the first question we had with the initial POC.  The
> reason is that this "sorted append" is not using a merge algorithm but
> just appending partitions in the right order, so it looked like we
> could either create a new SortedAppend node, or use current Append
> node and allow it to return sorted data.  We chose the 2nd solution,
> and ended up with a lot of duplicated code (all the code for the
> ordering), so we tried to have Append and MergeAppend share this code.
> I'm not at all satisfied with current shape, but I'm still not sure on
> what node to use for this.  Do you have any idea on this?

During planning, *every* node has a list of pathkeys associated with
it which represent the presumed output ordering.  You can support
ordered append paths without changing any data structures at all; it's
just a matter of putting pathkeys into an AppendPath.

The reason why MergeAppend has extra stuff in the node (numCols,
sortColIdx, etc.) is so that it can actually perform the sort at
runtime.  But this feature requires no runtime support -- that's kinda
the point -- so there's no need for it to carry that information, or
to add any new nodes.

At least, IIUC.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: [HACKERS] Rethinking autovacuum.c memory handling
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] [BUGS] BUG #14825: enum type: unsafe use?