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.92) (envelope-from ) id 1jCN6d-0007g1-N1 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2020 12:38:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jCN6a-0001dO-Ku for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2020 12:38:28 +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 1jCN6a-0001cJ-8b for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2020 12:38:28 +0000 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jCN6S-00067B-LH for pgsql-hackers@postgresql.org; Thu, 12 Mar 2020 12:38:26 +0000 Received: by mail-qv1-xf41.google.com with SMTP id c28so2476749qvb.10 for ; Thu, 12 Mar 2020 05:38:20 -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:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=nRUmwm2IIW/26XfW1QibGBmuc0YLSkz2hwu84GjimQY=; b=n9pqVGNfIocpDpsfRyK3/EW026s6UKxra9gcpY66/BSONiM6CaFeXJ1B32p3r3aYH3 5bIkUBzqhsVOXXCPtRFAafcgKvN3CslD4qtcLcANopg6K+qh/C3P0TomSKu1RWyjwPSG AhX58e3ezZugVPZ0MX1BNIod4vXHs3PwUkxkWBkqJaYReTImLVatyEPLEI1+Nkg1CB2S T9kLeNVUehGhnbBDgFUPzcvm1IWA8VyoIYWDvlV4kogQqWY+x1v1qPjyZkFAOC0sqU7+ DYgafeeZmscb+e2ZmvPFikt4/z4akGuWT5tYffAz/s6sd4sTvb2HKryWsPC+EAE+0L/g zDeQ== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nRUmwm2IIW/26XfW1QibGBmuc0YLSkz2hwu84GjimQY=; b=R65DUnZYedl6cyyBbOZXaHRHcAcgpBOS/gYVtzq64fhn8SMW2az9qbccdICgU57hX0 Fxc1Pd18m6IYe96JvmLPYVreNhpXndD/033tUmZ4kgBVDrXlCxdfc1l9clRn32yj1UJA IUQSEE5qV0qHA2qcWeuQzk/7cdirFQtPV7f4mSWyEd7VMcaV8xZfeHfmVauAJj4dqIMQ gCtx55zsZTGFK2cbB0esuX2HZOrVLUyRPPe6VXuXBEI1k8D3QdWazbiUn6TtP/mE7UwK 12ZxT3XBTA69VUuCTaa55YOcA4XntoJIOltb7UfAx1P0dYo5XuoqHXIrLVN3/S5vtL9V vSnw== X-Gm-Message-State: ANhLgQ15ZlsqFxdqhb46jYm0smiWqpwB5Lkf54IKR+3Wgchuz/PY3Z/i yfHtEslEKhvIZS56h1/0RhdRWw== X-Google-Smtp-Source: ADFU+vuoNHQK/mJ/boBjBPmFdVvA2HmrLOIgP8tzeA8MZ7sUNG2BpWALQoZ4YgxDpepwqNIfrNMM1A== X-Received: by 2002:ad4:4829:: with SMTP id h9mr5266875qvy.135.1584016698945; Thu, 12 Mar 2020 05:38:18 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id b66sm4660260qkf.66.2020.03.12.05.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 05:38:18 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 44E2E300AB4; Thu, 12 Mar 2020 09:38:16 -0300 (-03) Date: Thu, 12 Mar 2020 09:38:16 -0300 From: Alvaro Herrera To: Paul A Jungwirth Cc: David Fetter , Jeff Davis , Tom Lane , Pavel Stehule , Pgsql Hackers Subject: Re: range_agg Message-ID: <20200312123816.GA7777@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Paul, thanks for the thorough response to all these points. Regarding the merge of multiranges with ranges, I had also thought of that at some point and was leaning towards doing that, but after the latest responses I think the arguments against it are sensible; and now there's a clear majority for keeping them separate. I'll be posting an updated version of the patch later today. I was a bit scared bit this part: On 2020-Mar-11, Paul A Jungwirth wrote: > Finally, I think I mentioned this a long time ago, but I'm still not > sure if this patch needs work around these things: > > - gist opclass > - spgist opclass > - typanalyze > - selectivity > > I'd love for a real Postgres expert to tell me "No, we can add that > later" or "Yes, you have to add that now." While I think that the gist and spgist opclass are in the "very nice to have but still optional" category, the other two items seem mandatory (but I'm not 100% certain about that, TBH). I'm not sure we have time to get those ready during this commitfest. ... thinking about gist+spgist, I think they could be written identically to those for ranges, using the lowest (first) lower bound and the higher (last) upper bound. ... thinking about selectivity, I think the way to write that is to first compute the selectivity for the range across the first lower bound and the last upper bound, and then subtract that for the "negative" space between the contained ranges. I have no immediate thoughts about typanalyze. I suppose it should be somehow based on the implementation for ranges ... maybe a first-cut is to construct fake ranges covering the whole multirange (as above) and just use the ranges implementation (compute_range_stats). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services