Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4Bon-0003AQ-Ie for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Apr 2018 20:49:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f4Bom-00072S-Gq for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Apr 2018 20:49:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4Bom-00072H-9K for pgsql-hackers@lists.postgresql.org; Thu, 05 Apr 2018 20:49:12 +0000 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f4Boi-0000QM-N2 for pgsql-hackers@postgresql.org; Thu, 05 Apr 2018 20:49:11 +0000 Received: by mail-wr0-x22b.google.com with SMTP id l49so30553896wrl.4 for ; Thu, 05 Apr 2018 13:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uOUdkhIvP/bFkAJ/WJ+IoNtKsdreafB2Nl7KS1TqT10=; b=z/F+wCt9U2Kf4VI9dkiNVSF+WvKifA2xXY6g1kNHpysecacFGGw1RYlnnd5UATa4Bs JrWWD+Mdn0lWzlEJ4eCu1GqVZeMiBke/PfXBi07pRsPWt3LJ7TWSlvMoMnnpUXMr1Ent hupqO4BaOy9r0cWUqRZeEiLm6ZEfsvzV//z6GWhEuNrsdpEeDNpypL4ZCYatlzgHGUDj s3sVi/UaW2PBFcBgaff7FVZyT1++I2sWzQBrazRmQWlnK8ZbAAhcU3pzdr9Ed/XUYnEN X/uKSwpKjr/SEfDuYoaHYnPnIM8pUqVXEGPTVtnLK0NlVGAp1cfUkQoHwYLfLRl7wZu+ 2bYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uOUdkhIvP/bFkAJ/WJ+IoNtKsdreafB2Nl7KS1TqT10=; b=d4PQ5JsnX4P4a4Mg2XNgUIMPc/S6yaqGa8m3lOBWQ63zdfN3MHzlluudwhp5e7lkuV ZcOR480fKl/yhe8cJMvvPxYNyUYGKyBbyc5raHlSTQruxyJACkTvBiJqUBMSO+ZxgCht m/H8S+jCFv6AIzzLSAhiTAWw6gRyL4HiHbfDHkj5HSkI8fUIdJ/jDKuiIPQ6aDAxlK1c fDfEgg2KsuOqsg7sNj/9enXbfDSF8gQq1Q8BSA0/Cc6RzbJ7Qtl2LsW5j98DOlaL+Tyd PBh6btJ2CrqRYKPBPlJvCSF620Mh2Zftiy1JfO/U3iX6UlmxMwL1DVmKqlSrsfU6Yi+C PerQ== X-Gm-Message-State: AElRT7EZOu4FzzjmFOiIt/ad9mEYjN9+bhnK4nTk1UNBL/iYHf5bHUQh yz5w0Y5NDAhZeUkmChPzIaFremrurHgebpEWSgC3QJlDNF7Yyr+OitHlxebK+voJ0zIodh5l0MC YKxwawKjfpVWcm7h9oFE9MvZDll35AEpqNijko6DnsRcBN5oXo8et2MZQAW2HEzNLvWJ1F2RKgO RLWebyn9BfEKs= X-Google-Smtp-Source: AIpwx48suQlj5L0uIcvWPiSOeJQ88h/KIK8s3fVbY+yjuBvhvdlZ/Z6zqGXhWEJlJO4y9RJTvhN37A== X-Received: by 10.223.165.3 with SMTP id i3mr19400287wrb.283.1522961347138; Thu, 05 Apr 2018 13:49:07 -0700 (PDT) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id e27sm15092762wre.86.2018.04.05.13.49.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 13:49:06 -0700 (PDT) Subject: Re: Parallel Aggregates for string_agg and array_agg To: David Rowley Cc: Tom Lane , Stephen Frost , Andres Freund , PostgreSQL-development References: <20180326132009.GN24540@tamriel.snowman.net> <6538.1522096067@sss.pgh.pa.us> <25812.1522108164@sss.pgh.pa.us> <19216.1522207699@sss.pgh.pa.us> <18741.1522245278@sss.pgh.pa.us> <1ffa699d-ff84-4c21-10cb-4d8b36017bab@2ndquadrant.com> <13e3fd13-8152-72be-4e3c-8095e6ec0995@2ndquadrant.com> <73ea70fa-9ada-deb5-549e-02fa2f0969c6@2ndquadrant.com> From: Tomas Vondra Message-ID: <8f76820a-5d3a-bade-59c3-a3852b730826@2ndquadrant.com> Date: Thu, 5 Apr 2018 22:49:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/05/2018 05:41 AM, David Rowley wrote: > Hi Tomas, > > Thanks for taking another look. > > On 5 April 2018 at 07:12, Tomas Vondra wrote: >> Seems fine to me, although we should handle the anyarray case too, I >> guess. That is, get_agg_clause_costs_walker() should do this too: >> >> /* Same thing for array_agg_array_(de)serialize. */ >> if ((aggserialfn == F_ARRAY_AGG_ARRAY_SERIALIZE || >> aggdeserialfn == F_ARRAY_AGG_ARRAY_DESERIALIZE) && >> !agg_args_support_sendreceive(aggref)) >> costs->hasNonSerial = true; > > hmm, array_agg_array_serialize and array_agg_array_deserialize don't > use the send/receive functions though, so not sure why that's > required? > >> Other than that, the patch seems fine to me, and it's already marked as >> RFC so I'll leave it at that. > > Thanks. > >> The last obstacle seems to be the argument about the risks of the patch >> breaking queries of people relying on the ordering. Not sure what's are >> the right next steps in this regard ... > > yeah, seems like a bit of a stalemate. > > Personally, think if the group of people Tom mentions do exist, then > they've already been through some troubled times since Parallel Query > was born. I'd hope they've already put up their defenses due to the > advent of that feature. I stand by my thoughts that it's pretty > bizarre to draw the line here when we've probably been causing these > people issues for many years already. I said my piece on this already > so likely not much point in going on about it. These people are also > perfectly capable of sidestepping the whole issue with setting > max_parallel_workers_per_gather TO 0. > > Perhaps one solution is to drop the string_agg and keep the array_agg. > Unsure if that would be good enough for Tom? More people seem to have > voiced that array_agg ordering is generally less of a concern, which I > imagine is probably true, but my opinion might not matter here as I'm > the sort of person who if I needed a specific ordering I'd have > written an ORDER BY clause. > I don't really see how dropping string_agg would solve anything. Either the risks apply to both these functions, or neither of them I think. If anything, doing this only for one of them would be inconsistent and surprising, considering how similar they are. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services