Re: pg_stats and range statistics

2023-11-25 Thread Alexander Korotkov
On Sat, Nov 25, 2023 at 11:14 AM Egor Rogov wrote: > > Hi Alexander, > > On 25.11.2023 02:06, Alexander Korotkov wrote: > > > > In conclusion of all of the above, I decided to revise the patch and > > show the bounds histogram as it's stored in pg_statistic. I revised > > the docs

Re: pg_stats and range statistics

2023-11-25 Thread Alexander Korotkov
On Sat, Nov 25, 2023 at 10:58 AM jian he wrote: > On Sat, Nov 25, 2023 at 7:06 AM Alexander Korotkov > wrote: > > > > Hi! > > Additionally, I found that the current patch can't handle infinite > > range bounds and discards information about inclusiveness of range > > bounds. The infinite

Re: pg_stats and range statistics

2023-11-25 Thread Egor Rogov
Hi Alexander, On 25.11.2023 02:06, Alexander Korotkov wrote: In conclusion of all of the above, I decided to revise the patch and show the bounds histogram as it's stored in pg_statistic. I revised the docs correspondingly. So basically we returned to what it all has started from? I guess

Re: pg_stats and range statistics

2023-11-25 Thread jian he
On Sat, Nov 25, 2023 at 7:06 AM Alexander Korotkov wrote: > > Hi! > Additionally, I found that the current patch can't handle infinite > range bounds and discards information about inclusiveness of range > bounds. The infinite bounds could be represented as NULL (while I'm > not sure how good

Re: pg_stats and range statistics

2023-11-25 Thread jian he
On Sat, Nov 25, 2023 at 7:06 AM Alexander Korotkov wrote: > > Hi! > > I'm going to push this if there are no objections. > > -- > Regards, > Alexander Korotkov src/include/catalog/pg_statistic.h 268: * range type's subdiff function. Only non-null rows are considered. should it be: * range

Re: pg_stats and range statistics

2023-11-24 Thread Alexander Korotkov
Hi! On Wed, Sep 6, 2023 at 6:18 PM jian he wrote: > +lower(ARRAY[numrange(1.1,2.2),numrange(3.3,4.4)]) > should be > + > ranges_lower(ARRAY[numrange(1.1,2.2),numrange(3.3,4.4)]) > > +upper(ARRAY[numrange(1.1,2.2),numrange(3.3,4.4)]) > should be > + >

Re: pg_stats and range statistics

2023-09-06 Thread jian he
hi. I played around with the 2023-Apr 4 latest patch. +lower(ARRAY[numrange(1.1,2.2),numrange(3.3,4.4)]) should be + ranges_lower(ARRAY[numrange(1.1,2.2),numrange(3.3,4.4)]) +upper(ARRAY[numrange(1.1,2.2),numrange(3.3,4.4)]) should be +

Re: pg_stats and range statistics

2023-04-03 Thread Gregory Stark (as CFM)
it may have to wait until the next release. -- Gregory Stark As Commitfest Manager From 87424880f1a970448979681684e6916f33567eeb Mon Sep 17 00:00:00 2001 From: Greg Stark Date: Mon, 3 Apr 2023 17:04:11 -0400 Subject: [PATCH] pg_stats and range statistics --- doc/src/sgml/func.sgml

Re: pg_stats and range statistics

2023-03-24 Thread Egor Rogov
On 24.03.2023 01:46, Tomas Vondra wrote: 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, I've added some tests to resgress/sql/rangetypes.sql, based on the same dataset that is used to test lower() and upper().

Re: pg_stats and range statistics

2023-03-23 Thread Tomas Vondra
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 >>>

Re: pg_stats and range statistics

2023-03-20 Thread Egor Rogov
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

Re: pg_stats and range statistics

2023-03-20 Thread Gregory Stark (as CFM)
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

Re: pg_stats and range statistics

2023-01-23 Thread Egor Rogov
On 23.01.2023 13:01, Egor Rogov wrote: On 23.01.2023 02:21, Tomas Vondra wrote: On 1/22/23 22:33, Justin Pryzby wrote: On Sun, Jan 22, 2023 at 07:19:41PM +0100, Tomas Vondra wrote: On 1/21/23 19:53, Egor Rogov wrote: Hi Tomas, On 21.01.2023 00:50, Tomas Vondra wrote: This simply adds two

Re: pg_stats and range statistics

2023-01-23 Thread Egor Rogov
Hi, On 23.01.2023 02:21, Tomas Vondra wrote: On 1/22/23 22:33, Justin Pryzby wrote: On Sun, Jan 22, 2023 at 07:19:41PM +0100, Tomas Vondra wrote: On 1/21/23 19:53, Egor Rogov wrote: Hi Tomas, On 21.01.2023 00:50, Tomas Vondra wrote: This simply adds two functions, accepting/producing

Re: pg_stats and range statistics

2023-01-22 Thread Tomas Vondra
On 1/22/23 22:33, Justin Pryzby wrote: > On Sun, Jan 22, 2023 at 07:19:41PM +0100, Tomas Vondra wrote: >> On 1/21/23 19:53, Egor Rogov wrote: >>> Hi Tomas, >>> On 21.01.2023 00:50, Tomas Vondra wrote: This simply adds two functions, accepting/producing anyarray - one for lower bounds,

Re: pg_stats and range statistics

2023-01-22 Thread Justin Pryzby
On Sun, Jan 22, 2023 at 07:19:41PM +0100, Tomas Vondra wrote: > On 1/21/23 19:53, Egor Rogov wrote: > > Hi Tomas, > > On 21.01.2023 00:50, Tomas Vondra wrote: > >> This simply adds two functions, accepting/producing anyarray - one for > >> lower bounds, one for upper bounds. I don't think it can

Re: pg_stats and range statistics

2023-01-22 Thread Tomas Vondra
On 1/21/23 19:53, Egor Rogov wrote: > Hi Tomas, > > On 21.01.2023 00:50, Tomas Vondra wrote: >> Hi Egor, >> >> While reviewing a patch improving join estimates for ranges [1] I >> realized we don't show stats for ranges in pg_stats, and I recalled we >> had this patch. >> >> I rebased the v2, and

Re: pg_stats and range statistics

2023-01-21 Thread Egor Rogov
Hi Tomas, On 21.01.2023 00:50, Tomas Vondra wrote: Hi Egor, While reviewing a patch improving join estimates for ranges [1] I realized we don't show stats for ranges in pg_stats, and I recalled we had this patch. I rebased the v2, and I decided to took a stab at showing separate histograms

Re: pg_stats and range statistics

2023-01-20 Thread Tomas Vondra
Hi Egor, While reviewing a patch improving join estimates for ranges [1] I realized we don't show stats for ranges in pg_stats, and I recalled we had this patch. I rebased the v2, and I decided to took a stab at showing separate histograms for lower/upper histogram bounds. I believe it makes it

Re: pg_stats and range statistics

2021-07-23 Thread Egor Rogov
Hi Tomas, On 12.07.2021 16:04, Tomas Vondra wrote: On 7/12/21 1:10 PM, Egor Rogov wrote: Hi, thanks for the review and corrections. On 11.07.2021 21:54, Soumyadeep Chakraborty wrote: Hello, This should have been added with [1]. Excerpt from the documentation: "pg_stats is also designed to

Re: pg_stats and range statistics

2021-07-12 Thread Tomas Vondra
On 7/12/21 1:10 PM, Egor Rogov wrote: > Hi, > > thanks for the review and corrections. > > On 11.07.2021 21:54, Soumyadeep Chakraborty wrote: >> Hello, >> >> This should have been added with [1]. >> >> Excerpt from the documentation: >> "pg_stats is also designed to present the information in a

Re: pg_stats and range statistics

2021-07-12 Thread Egor Rogov
Hi, thanks for the review and corrections. On 11.07.2021 21:54, Soumyadeep Chakraborty wrote: Hello, This should have been added with [1]. Excerpt from the documentation: "pg_stats is also designed to present the information in a more readable format than the underlying catalog — at the cost

Re: pg_stats and range statistics

2021-07-11 Thread Soumyadeep Chakraborty
Hello, This should have been added with [1]. Excerpt from the documentation: "pg_stats is also designed to present the information in a more readable format than the underlying catalog — at the cost that its schema must be extended whenever new slot types are defined for pg_statistic." [2] So,

Re: pg_stats and range statistics

2021-06-18 Thread Tomas Vondra
On 6/18/21 6:22 PM, Egor Rogov wrote: Hi, Statistics for range types are not currently exposed in pg_stats view (i.e. STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM and STATISTIC_KIND_BOUNDS_HISTOGRAM). Shouldn't they? If so, here is a patch for adding them. I think they should be exposed - I

pg_stats and range statistics

2021-06-18 Thread Egor Rogov
Hi, Statistics for range types are not currently exposed in pg_stats view (i.e. STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM and STATISTIC_KIND_BOUNDS_HISTOGRAM). Shouldn't they? If so, here is a patch for adding them. The following is a simple example of what it looks like: CREATE TABLE test(r