mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Support MergeAppend plans, to allow sorted output from append relations.
This patch eliminates the former need to sort the output of an Append scan when an ordered scan of an inheritance tree is wanted. This should be particularly useful for fast-start cases such as queries with LIMIT. Original patch by Greg Stark, with further hacking by Hans-Jurgen Schonig, Robert Haas, and Tom Lane.
This commit is contained in:
@ -554,6 +554,24 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case T_MergeAppend:
|
||||
{
|
||||
MergeAppend *splan = (MergeAppend *) plan;
|
||||
|
||||
/*
|
||||
* MergeAppend, like Sort et al, doesn't actually evaluate its
|
||||
* targetlist or check quals.
|
||||
*/
|
||||
set_dummy_tlist_references(plan, rtoffset);
|
||||
Assert(splan->plan.qual == NIL);
|
||||
foreach(l, splan->mergeplans)
|
||||
{
|
||||
lfirst(l) = set_plan_refs(glob,
|
||||
(Plan *) lfirst(l),
|
||||
rtoffset);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case T_RecursiveUnion:
|
||||
/* This doesn't evaluate targetlist or check quals either */
|
||||
set_dummy_tlist_references(plan, rtoffset);
|
||||
|
Reference in New Issue
Block a user