Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iELhx-0005ZU-TJ for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Sep 2019 23:00:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iELhw-0003b1-Ks for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Sep 2019 23:00:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iELhw-0003aB-8l for pgsql-hackers@lists.postgresql.org; Sat, 28 Sep 2019 23:00:56 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iELht-0007AV-Bu for pgsql-hackers@lists.postgresql.org; Sat, 28 Sep 2019 23:00:54 +0000 Received: by mail-wm1-x343.google.com with SMTP id f22so8947140wmc.2 for ; Sat, 28 Sep 2019 16:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VBljCA0dJhVCjPwPZKnFInboC/MijQHmwuUvOlawCKY=; b=uA6dV5F9KkoQoEmFBtCxMojsHIzREsb9t35Mn97v7bTP9Vdaera8W3OHihuLmeSBdV SCM/Yi4a/pLa06l9JvzgVp9IQ0RKLFLrhZtC2Zto50zCaYgJOcYxUUzDSEeue1Q60vwO B0zObxsoyge1A5S3QkWLqs3uZ+x53L80h/O+6ci3DNGLU6adHTp/UB7JWL6VyW9xoInA 82tlcznppGjTtnFDVYD/h4Gpa8a6eXvLzoRlgPvIouQx51Tc9IL97P2LXSF4akdweVYd eJTPSvuaMDDPHbTYaWeN7qXzSUfZmkq+sQRGxCYrCF6ZrIPPmTx6eLpX92h1YSPw8Ngg 2RPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VBljCA0dJhVCjPwPZKnFInboC/MijQHmwuUvOlawCKY=; b=eGTpSFOicHMb1m09X3oj2N/Atm/QND1WKieMO+G7TCp+yz61lz5YNXmQFUGT6DVzjB CoJFliLSExrkSyKiG+nYDm4eRsvAcoMMx7oenshNNyax2SJTyT/gN32TOK19uHgYkMpF yg0r5tBQe0Y1ZNz6zbZJ2WDiaPXT2EJ+/b4zXa41d54xVdwpARh8WbB3HD8XiNfM9rKF 1vVcQFjPFlOh3x4rG4IKNLweoRcBLgkQM20JSZ94RKcINjpc0bFkUtm/NYjZTny4AcL9 PN2kTxc9xe8ox2qPdHvsz5mR164KGnU/gxwo4PdFe1bWe1Vy+j8P2BwlMOEUTitSUjz9 WZPw== X-Gm-Message-State: APjAAAVskJ7uePLna6yHZOQzhx2m+p6jJWm47hzSr/6KXmgZgCQjJSO6 0ljH675Gf70z6f1EpayDHmY7Gg== X-Google-Smtp-Source: APXvYqyIvai3Y5aTgQoq8fLgn28uMr/WGwcLvies/3pkGk+lk60040DUIrMHt5oGrEzJmH+vLobcEw== X-Received: by 2002:a7b:c92b:: with SMTP id h11mr12202556wml.10.1569711651911; Sat, 28 Sep 2019 16:00:51 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id w12sm14650855wrg.47.2019.09.28.16.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Sep 2019 16:00:51 -0700 (PDT) Date: Sun, 29 Sep 2019 01:00:49 +0200 From: Tomas Vondra To: James Coleman Cc: Rafia Sabih , Peter Geoghegan , Simon Riggs , Shaun Thomas , Dmitry Dolgov <9erthalion6@gmail.com>, Alexander Korotkov , Tom Lane , PostgreSQL Developers , Alvaro Herrera Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort) Message-ID: <20190928230049.k4l2mayun7jomhxy@development> References: <20190720165951.m6adwbqi26bsfbjb@development> <20190721113422.hjubqs45xxpnldn7@development> <20190730001711.hprrcx3ntk57wuqv@development> <20190904191710.gogtnktjbvtg5zq3@development> <20190909215538.42hrv6j4z5ztcft4@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Sep 27, 2019 at 01:50:30PM -0400, James Coleman wrote: >On Mon, Sep 9, 2019 at 5:55 PM Tomas Vondra > wrote: >> The "patched" column means all developer GUCs disabled, so it's expected >> to produce the same plan as master (and it is). And then there's one >> column for each developer GUC. If the column is just TRUE it means the >> GUC does not affect any of the synthetic queries. There are 4 of them: >> >> - devel_add_paths_to_grouping_rel_parallel >> - devel_create_partial_grouping_paths >> - devel_gather_grouping_paths >> - devel_standard_join_search >> >> The places controlled by those GUCs are either useless, or the query >> affected by them is not included in the list of queries. > >I'd previously found (in my reverse engineering efforts) the query: > >select * >from tenk1 t1 >join tenk1 t2 on t1.hundred = t2.hundred >join tenk1 t3 on t1.hundred = t3.hundred >order by t1.hundred, t1.twenty >limit 50; > >can change plans to use incremental sort when >generate_useful_gather_paths() is added to standard_join_search(). >Specifically, we get a merge join between t1 and t3 as the top level >(besides limit) node where the driving side of the join is a gather >merge with incremental sort. This does rely on these gucs set in the >test harness: > >set local max_parallel_workers_per_gather=4; >set local min_parallel_table_scan_size=0; >set local parallel_tuple_cost=0; >set local parallel_setup_cost=0; > >So I think we can reduce the number of unused gucs to 3. > OK. I'll try extending the set of synthetic queries in [1] to also do soemthing like this and generate similar plans. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services