Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfThT-00052S-Gc for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2023 22:46:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pfThR-0002L6-SJ for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2023 22:46:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfThR-0002Kx-Hp for pgsql-hackers@lists.postgresql.org; Thu, 23 Mar 2023 22:46:25 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pfThO-0001gc-9u for pgsql-hackers@lists.postgresql.org; Thu, 23 Mar 2023 22:46:24 +0000 Received: by mail-lf1-x12c.google.com with SMTP id j11so29730155lfg.13 for ; Thu, 23 Mar 2023 15:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1679611581; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sdUdyTGXuLiH8tl7aGP+0DzEWkhy8fqFEd6k8ay/V/g=; b=aBXc/99nrk6ve7cgX96s0sFmrFZMHJElxSQlmnlYfxgjUsAzNkIpM4Ga60j6CjZ4ub dOCLoNv8Xg7kXq5uO4yHWIXxKmUi1hAub1sh0oKYsmPXyvwLlNYD3r87Sq2omDgCg7HD vbp60wgo49A3+DdFDm01AGf82gDh9et8gw9nSUsNHTelmB5oHEKWD5oeTAh5c41i4wRT otsImuVyD4qKJ8z6qjRy8FqLnncfHpeuylEz0IJ998Dk2VmujNmj4HxcAxXQrlkkiWTL 6m10Tw22xsZj40nz519qYX5xYOzHNQSno+d6J3S2JMZRISKw0IiPye5N6cn0Vfdqa4qO n3nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679611581; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sdUdyTGXuLiH8tl7aGP+0DzEWkhy8fqFEd6k8ay/V/g=; b=i5xhg9dXE2rPs2SJPvU7TtSdmcChBWkXK4o9s1AHTMp7JR6j2dca53hGI2eUaSTgHK QBGMT5YZulVf/4mw1r0AIUVVeJsMtAMjKI7iXu4ZkSvoZZrQjbYPokXKS1iNqYO7MXWS xpZCKSVo4yeIMjU5lqzUOmOn3oEFFoTb5kkzhUWdbQLa/jV0UpN70hoqS4YFYyeCYUPB 977UzA5y4WWi5KjOv48wlFfCDYMbWc4rJNBoePOPrdcvN5JaJKE7RsDtnVP9fIk8EwUo qA4o/Qclf43Va4IU/gnaUvf0kAb9ESFki71y1bsHTM15oehT02weDmb8Vo38MDU5rSYB /AWw== X-Gm-Message-State: AAQBX9c5t6ZSUFGK5mE1kTpFk1c+ziA5QQ3FM86Pf/PnfO4DfjpW9F1O jspvtfAPw/5Qm3NAM+wMlhW9o8HgSzWJNcF5chZy3LBD/6duA6QRuTG5QLqTmpCTdaYWuS4aELW EYE0r6yLZfUlsFDDueMASFRfNvjQCVJk015BuYk9a4jUA11nadan9c95Uk1jVDXCxTbVH5TBaH2 88PQmDmzb8BPXSOzD0M/nIhtzz5F63omnz4oEv4Xvt3m0s9wEZTKnv X-Google-Smtp-Source: AKy350aOsxUx3aWeW9TNDsCVeYztf7RSGQTRCPJVpIZxfcF7P8NW3Z2USQdnOZGLHmlLsx80CdiJrQ== X-Received: by 2002:a19:700e:0:b0:4de:3774:2d97 with SMTP id h14-20020a19700e000000b004de37742d97mr109606lfc.13.1679611580757; Thu, 23 Mar 2023 15:46:20 -0700 (PDT) Received: from [10.137.0.17] ([84.217.81.189]) by smtp.gmail.com with ESMTPSA id w9-20020a05651203c900b004db2ac3a522sm3123388lfp.62.2023.03.23.15.46.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Mar 2023 15:46:20 -0700 (PDT) Message-ID: Date: Thu, 23 Mar 2023 23:46:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: pg_stats and range statistics Content-Language: en-US To: Egor Rogov , "Gregory Stark (as CFM)" Cc: Justin Pryzby , Soumyadeep Chakraborty , pgsql-hackers@lists.postgresql.org References: <55c8ecd4-57d0-5c63-6fe3-1b81e8caea9d@enterprisedb.com> <20230122213310.GQ13860@telsasoft.com> <7ae24b59-782a-a531-fae5-e498e4eaa0e7@enterprisedb.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/20/23 20:54, Egor Rogov wrote: > On 20.03.2023 22:27, Gregory Stark (as CFM) wrote: >> On Sun, 22 Jan 2023 at 18:22, Tomas Vondra >> wrote: >>> I wonder if we have other functions doing something similar, i.e. >>> accepting a polymorphic type and then imposing additional restrictions >>> on it. >> Meh, there's things like array comparison functions that require both >> arguments to be the same kind of arrays. And array_agg that requires >> the elements to be the same type as the state array (ie, same type as >> the first element). Not sure there are any taking just one specific >> type though. >> >>>> Shouldn't this add some sql tests ? >>> Yeah, I guess we should have a couple tests calling these functions on >>> different range arrays. >>> >>> This reminds me lower()/upper() have some extra rules about handling >>> empty ranges / infinite boundaries etc. These functions should behave >>> consistently (as if we called lower() in a loop) and I'm pretty sure >>> that's not the current state. >> Are we still waiting on these two items? Egor, do you think you'll >> have a chance to work it for this month? > > > I can try to tidy things up, but I'm not sure if we reached a consensus. > We don't have any objections, and that's probably the best consensus we can get here, I guess ... So if you could clean it up a bit, and do something about the two open items I mentioned (a bunch of tests on different array, and behavior consistent with lower/upper), that'd be great. > Do we stick with the ranges_upper(anyarray) and ranges_lower(anyarray) > functions? This approach is okay with me. Tomas, have you made up your > mind? > I think the function approach is fine, but in my January 22 message I was wondering why we're not actually naming them simply lower/upper. > Do we want to document these functions? They are very > pg_statistic-specific and won't be useful for end users imo. > I don't see why not to document them. Sure, we're using them in a fairly specific context, but I don't see why not to let people use them too (which would be hard without docs). regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company