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 1ej4Qj-0005Lf-NJ for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2018 14:41:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ej4Qi-0001Hl-P6 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2018 14:41:04 +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.84_2) (envelope-from ) id 1ej4Qi-0001Hb-9P for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2018 14:41:04 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ej4Qe-0005bs-Mg for pgsql-hackers@postgresql.org; Tue, 06 Feb 2018 14:41:03 +0000 Received: by mail-wr0-x244.google.com with SMTP id v31so2174959wrc.11 for ; Tue, 06 Feb 2018 06:41:00 -0800 (PST) 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=5Wplrg4xLNPfj7nPz5+obMTRVNDMsyLhg6K5BsnOiZw=; b=VU+3s07/eBsUjjIygWEiRSJVeutyKS0A+cpYu7XqQktyEpUj/KCMLFmi7NsZNtaoMy K1OQ/AB6XmjtAztCN8CQfZOAyukjU2NjGpxU5Zno1ZQiNSQMTGpkDQYwko0FvYYgE/7E o6Ct9pFsQK9IhHhoLiIe6R3rgPZk6OlQqkcT6SP/qH+jVD11t2V04arylGAhDY5nGr/l Q8eZaV76PjCbZxduk0Xthiuxs+LERqHIFvFrUrNq0o7bs4eJ2cUo1VO2yq/NVfGmUdrF A7tP71pJCZexEg7pQgYFpoo/O6nglbUh2H5cKoYd2/44CdhEEN4/u5CEuU3Sy3I2Fp/D Rzpg== 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=5Wplrg4xLNPfj7nPz5+obMTRVNDMsyLhg6K5BsnOiZw=; b=UrCqy6zfLOkTf1oZllrHvdHucejYsrfJVJiv8Ouf4dEZBtq5xtlC19Z2TvPPQQHU45 O01fEdWAHHc6x5VVGdV+lDV1CJ+clYINuN53FmMRNy/uB+yma36ci5b2jPo2rICmGb8Q ouf0YenxTKv6VwA1cNGudR8PeLR4BL+N9QhLfD85JhXO6JvK0n+0TmtLD/jLAr25JJIo 2HNlF4g9NxvVcoeLtiquQSUaGNJGzZMsgvfqe0cwnOB5oV+IthDQhyBfIGGZ/yjL0FxD uSpidTRwgVDKbzCpRzKqZedMn+iTlBPS5EQbBP9UUB4qpsZxT6YA9BFitDDJkLJoFGkH Vk+Q== X-Gm-Message-State: APf1xPDJCUStK8knIPIAMe7Aak+CTVZ5lJIYpg2bjo7TSfE5/51dk8xe b89SrLKgvVWx3ru9eai5MhGt6HDRgy2oBAz+Lk0ZCZgv6XqSXVFTmcqpTuP6QRWEC+nMDxRFj2W V16PWDDEVzSzpMP7c6+6NaqwY1H3QMvMpC0wvw+miUi/Im6AizvYKpsvCdIF9OyuLLkDne35AoG vdJFZpzLoN X-Google-Smtp-Source: AH8x224Jf6Gr88v/61F6jeRNud0XiZ7ibA2IEDMqYFf+5pG/rrUkuNYeKgL3lRN2BwnkYHTD7ToDhA== X-Received: by 10.223.209.3 with SMTP id a3mr2393285wri.27.1517928057257; Tue, 06 Feb 2018 06:40:57 -0800 (PST) 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 t5sm7660687wra.47.2018.02.06.06.40.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 06:40:56 -0800 (PST) Subject: Re: [HACKERS] MERGE SQL Statement for PG11 To: Peter Geoghegan , Robert Haas Cc: Simon Riggs , Alvaro Herrera , Andrew Dunstan , Pavan Deolasee , Stephen Frost , PostgreSQL-development References: From: Tomas Vondra Message-ID: <50394f44-af78-b40f-313a-5b0f8a0450e4@2ndquadrant.com> Date: Tue, 6 Feb 2018 15:40:53 +0100 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 02/06/2018 05:20 AM, Peter Geoghegan wrote: > On Mon, Feb 5, 2018 at 7:56 PM, Robert Haas wrote: >> I don't think you get to make a unilateral decision to exclude >> features that work everywhere else from the scope of this patch. >> If there is agreement that those features can be left out of scope, >> then that is one thing, but so far all the commentary about the >> things that you've chosen to exclude has been negative. Nor have >> you really given any reason why they should be exempt. You've >> pointed out that parallel query doesn't handle everything (which is >> certainly true, but does not mean that any feature from now and the >> end of time is allowed to exclude from scope whatever seems >> inconvenient regardless of contrary community consensus) and you've >> pointed out here and elsewhere that somebody could go add the >> features you omitted later (which is also true, but misses the >> general point that we want committed patches to be reasonably >> complete already, not have big gaps that someone will have to fix >> later). > > For me, the concern is not really the omission of support for > certain features as such. The concern is that those omissions hint > that there is a problem with the design itself, particularly in the > optimizer. Allowing subselects in the UPDATE part of a MERGE do not > seem like they could be written as a neat adjunct to what Simon > already came up with. If that was possible, Simon probably already > would have done it. > I agree with both of these statements wholeheartedly. As I mentioned at the developer meeting last week, whenever someone asks me for reasons why I find PostgreSQL better than MySQL, I usually point them to "MySQL Restrictions and Limitations" document. Which is pretty much a matrix of features that do not work together in some way. It would be somewhat unfortunate to get on that route too ... So I think the general principle should be to make the features as complete as possible. For the more complex features that may not be quite achievable, though, forcing us to add the pieces over multiple releases. Which is what happened with partitioning, for example. I think we can do that for MERGE too, assuming we actually understand (1) why each of the pieces is missing (2) what would it take to make it work I'm not sure we have those answers for MERGE, though. I haven't done anything on the MERGE patch so far, and I've been unable to convince myself what the reasoning is for the limitations. Perhaps there are explanations somewhere far back in the thread, but considering how much both the implementation and our understanding of it changed over time, I'm not sure how relevant those past arguments are. Take for example the "sub-selects are not supported" limitation. It's not clear to me why this does not work. I see claims that SQL standard says something about it (but not what exactly), that it supposedly depends on how we handle concurrency, and perhaps other reasons. Furthermore, there are multiple places where the sub-select might be, and I'm not sure which of those arguments applies to which case. Without answering (2) I think it's perfectly understandable Peter is concerned we may run into design issues later, when we try to address some of the limitations. I plan to go through the patch and this thread over the couple of days, and summarize what the current status is (or my understanding of it). That is (a) what are the missing pieces, (b) why are they missing, (c) how we plan to address them in the future and (d) opinions on these issues expressed by others on this thread. kind regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services