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 1f3nqO-00085c-Sp for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Apr 2018 19:13:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f3nqL-0005sd-Nd for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Apr 2018 19:13:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3nqL-0005sT-7K for pgsql-hackers@lists.postgresql.org; Wed, 04 Apr 2018 19:13:13 +0000 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f3nqF-0006Mf-3N for pgsql-hackers@postgresql.org; Wed, 04 Apr 2018 19:13:10 +0000 Received: by mail-wr0-x230.google.com with SMTP id l49so24465259wrl.4 for ; Wed, 04 Apr 2018 12:13:06 -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=ZiTWwNZGVFp0SVRgnpdLsq4R/nNkO7+WIbJ1xGZbT3I=; b=QwK1zO7CBoG4kOq+z7tEwmVN+TrtCtIM0yKTlJ88CpSTu8KP9VA6fGUBDjF/qLNURB XotgVsi7gXzxRi77eR2iGMBG2c/VMq0MknhxZKqcABbtriS6s/Qvun0TPyaPycNbb5X1 Fu800pHyuPudLIbLhg0yHu2Ce5/wlGYhStmQVWnYhYNl1HqQMJIP0FEMg91Wh8WTTkXL U3qWrXwnUTqtF1qdMW83B+wRRqGi1F/OttOGbtjx9Ao5XQZORG8GOTJ5Ici6I6e6ZCm2 HBrlFQGh0n+f1h2XNMi3mTiii+V1017G0FhDDYt9JHG8R25Ug272zvbPnNO5IPofvGIq oOjQ== 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=ZiTWwNZGVFp0SVRgnpdLsq4R/nNkO7+WIbJ1xGZbT3I=; b=deq0YDdwBlaQFfx2mhQDIlo5IiYgdsU2boOJ9EJ3qv4hqGQQFobhzaO76JoRhU7LN6 rxEx7ZFDM3rVeJ9JCo6jYK+1ZLrqqJ5x69W+EBOlKUDqH4PJb8QYd6Twl7YyB2yNYlJ7 d5Rn1YvjPQ/cz4eAimzW3rXvWEwsI3kfKYEsF8LVsxLUzTGTi7X0TB0bnCcTZlNGGU0W 0g8VHqbYDjW4YT4L1Uboruuad0sMzFtulL35+OIguqzxbHML/o601IsyQil+azd11xma xKKI5l5z+ltAD5AEGJXepNu/E8OlfkpY5IRfGG3S12HEXCHvm9YomhAAl59p7c/E3SUJ eQ/Q== X-Gm-Message-State: AElRT7Ej6KIaNh24TXixdrbq3E/dbvzk66qX368CFAveOEFO5BcgwULF nnmObIZaMpI7mOqc7h0kd4Qu1PzxDzPaPynLKbJ4UAnesL6mBk6nrD0M+rAFS7hloX1HxLzgj/V K43p3FZrxAyxPvlHM2GWzwZAXRA9hPpYfbW9OUgh8aeuFnLJDZBjpfn0XUmhEvh1uJ7JI6piTpU TTz/o+9zBS X-Google-Smtp-Source: AIpwx48aPwiVRyyGrGL6qFS6elGfIC2jO5s7QeReksqjwmyT2rLDDcAnbcN3Rzr3j4n+mAOsRdwl3g== X-Received: by 10.223.150.117 with SMTP id c50mr13846170wra.196.1522869183618; Wed, 04 Apr 2018 12:13:03 -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 a62sm3363144wmh.5.2018.04.04.12.12.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Apr 2018 12:12:58 -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: <20180326022647.GL24540@tamriel.snowman.net> <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: Date: Wed, 4 Apr 2018 21:12:54 +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 03/31/2018 04:42 PM, David Rowley wrote: > On 30 March 2018 at 02:55, Tomas Vondra wrote: >> On 03/29/2018 03:09 PM, David Rowley wrote: >>> I meant to mention earlier that I coded >>> agg_args_have_sendreceive_funcs() to only check for send/receive >>> functions. Really we could allow a byval types without send/receive >>> functions, since the serial/deserial just send the raw datums in that >>> case, but then the function becomes >>> agg_byref_args_have_sendreceive_funcs(), which seemed a bit obscure, >>> so I didn't do that. Maybe I should? >> >> I'd do that. Not sure the function name needs to change, but perhaps >> agg_args_support_sendreceive() would be better - it covers both byref >> types (which require send/receive functions) and byval (which don't). > > The attached patch implements this. > 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; Other than that, the patch seems fine to me, and it's already marked as RFC so I'll leave it at that. 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 ... regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services