pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arne Roland <A.Roland@index.de>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path
Date: Thu, 9 Dec 2021 23:51:02 +0000
Message-ID: <0a472445febe4886b629a71aa70de1a9@index.de> (raw)
In-Reply-To: <c63df478-a3e7-234d-ea49-b3154fa53409@enterprisedb.com>
References: <e8f9ec90-546d-e948-acce-0525f3e92773@enterprisedb.com>
	<c63df478-a3e7-234d-ea49-b3154fa53409@enterprisedb.com>

Hi,

thanks for the reply!

From: Tomas Vondra <tomas.vondra@enterprisedb.com>
Sent: Thursday, December 2, 2021 20:58
Subject: Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path
> [...]
> Well, I mentioned three open questions in my first message, and I don't
> think we've really addressed them yet. We've agreed we don't need to add
> the incremental sort here, but that leaves
>
>
> 1) If get_cheapest_fractional_path_for_pathkeys returns NULL, should we
> default to cheapest_startup or cheapest_total?

I think it's reasonable to use cheapest_total like we are doing now. I hardly see any reason to change it.
The incremental sort case you mentioned, seems like the only case that plan might be interesting. If we really want that to happen, we probably should check for that separately, i.e. having startup_fractional. Even though this is a fairly special case as it's mostly relevant for partitionwise joins, I'm still not convinced it's worth the cpu cycles. The point is that in most cases factional and startup_fractional will be the same anyways.
And I suspect, even if they aren't, solving that from an application developers point of view, is in most cases not that difficult. One can usually match the pathkey. I personally had a lot of real world issues with missing fractional paths using primary keys. I think it's worth noting that everything will likely match the partition keys anyways, because otherwise there is no chance of doing a merge append.
If I am not mistaken, in case we end up doing a full sort, the cheapest_total path should be completely sufficient.

> 2) Should get_cheapest_fractional_path_for_pathkeys worry about
> require_parallel_safe? I think yes, but we need to update the patch.

I admit, that such a version of get_cheapest_fractional_path_for_pathkeys could be consistent with other functions. And I was confused about that before. But I am not sure what to use require_parallel_safe for. build_minmax_path doesn't care, they are never parallel safe. And afaict generate_orderedappend_paths cares neither, it considers all plans. For instance when it calls get_cheapest_path_for_pathkeys, it sets require_parallel_safe just to false as well.

> I'll take a closer look next week, once I get home from NYC, and I'll
> submit an improved version for the January CF.

Thank you for your work! The current patch, apart from the comments/regression tests, seems pretty reasonable to me.

Regards
Arne

view thread (19+ messages)  latest in thread

Message-ID: <0a472445febe4886b629a71aa70de1a9@index.de>
Permalink:  ../0a472445febe4886b629a71aa70de1a9@index.de/
Also on:    postgresql.org/message-id/0a472445febe4886b629a71aa70de1a9@index.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: A.Roland@index.de, tomas.vondra@enterprisedb.com
  Subject: Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path
  In-Reply-To: <0a472445febe4886b629a71aa70de1a9@index.de>
  References: <e8f9ec90-546d-e948-acce-0525f3e92773@enterprisedb.com> <c63df478-a3e7-234d-ea49-b3154fa53409@enterprisedb.com> <0a472445febe4886b629a71aa70de1a9@index.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox