Re: Statistics and selectivity estimation for ranges

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Statistics and selectivity estimation for ranges
Date: 2012-12-13 20:40:33
Message-ID: CAPpHfdtHXh+xuJzKBbzK1NFjbtia5vzK35uJiXgiKE9oaqmtOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Jeff!

Thanks a lot for review!

On Mon, Dec 10, 2012 at 11:21 PM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:

> It looks like there are still some problems with this patch.
>
> CREATE TABLE foo(ir int4range);
> insert into foo select 'empty' from generate_series(1,10000);
> insert into foo select int4range(NULL, g, '(]')
> from generate_series(1,1000000) g;
> insert into foo select int4range(g, NULL, '[)')
> from generate_series(1,1000000) g;
> insert into foo select int4range(g, ((g*1.01)+10)::int4, '[]')
> from generate_series(1,1000000) g;
> CREATE TABLE bar(ir) AS select * from foo order by random();
> ANALYZE bar;
>
> Now:
> EXPLAIN ANALYZE SELECT * FROM bar
> WHERE ir @> int4range(10000,20000);
>
> The estimates are "-nan". Similar for many other queries.
>

Oh, yeah! It appears that infinities require much more cautious work with
them than I supposed. That should be fixes in the attached version of
patch. However, it require significant rethinking of comments. Will update
comments and address your questions in a couple of days. Could you recheck
if attached patch really fixes problem you reported?

------
With best regards,
Alexander Korotkov.

Attachment Content-Type Size
range_stat-0.9.patch.gz application/x-gzip 7.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-13 20:40:43 Re: Logical decoding & exported base snapshot
Previous Message Andres Freund 2012-12-13 20:03:44 Re: logical decoding - GetOldestXmin