Re: Considering fractional paths in Append node
Andrei Lepikhov <lepihov@gmail.com>
From: Andrei Lepikhov <lepihov@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Nikita Malakhov <hukutoc@gmail.com>, Andy Fan <zhihuifan1213@163.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>,
David Rowley <dgrowleyml@gmail.com>
Date: 2025-03-05T06:31:39Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Teach Append to consider tuple_fraction when accumulating subpaths.
- fae535da0ac2 18.0 landed
On 5/3/2025 03:27, Alexander Korotkov wrote: > On Mon, Mar 3, 2025 at 1:04 PM Andrei Lepikhov <lepihov@gmail.com> wrote: >>> 2. As usage of root->tuple_fraction RelOptInfo it has been criticized, >>> do you think we could limit this to some simple cases? For instance, >>> check that RelOptInfo is the final result relation for given root. >> I believe that using tuple_fraction is not an issue. Instead, it serves >> as a flag that allows the upper-level optimisation to consider >> additional options. The upper-level optimiser has more variants to >> examine and will select the optimal path based on the knowledge >> available at that level. Therefore, we're not introducing a mistake >> here; we're simply adding extra work in the narrow case. However, having >> only the bottom-up planning process, I don't see how we could avoid this >> additional workload. > > Yes, but if we can assume root->tuple_fraction applies to result of > Append, it's strange we apply the same tuple fraction to all the child > rels. Latter rels should less likely be used at all and perhaps > should have less tuple_fraction. Of course, it may happen. But I'm not sure it is a common rule. Using LIMIT, we usually select data according to specific clauses. Imagine, we need TOP-100 ranked goods. Appending partitions of goods, we will use the index on the 'rating' column. But who knows how top-rated goods are spread across partitions? Maybe a single partition contains all of them? So, we need to select 100 top-rated goods from each partition. Hence, applying the same limit to each partition seems reasonable, right? -- regards, Andrei Lepikhov