pg.ddx.io pgsql-performance@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Igor ALBUQUERQUE SILVA <i.albuquerque-silva@kayrros.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Geometric types row estimation
Date: Wed, 30 Nov 2022 12:18:41 -0500
Message-ID: <1358779.1669828721@sss.pgh.pa.us> (raw)
In-Reply-To: <CADArKzXZnFixqw-GRkpwOasYzJRQOE7qH-6XgocG_njvM7EMmA@mail.gmail.com>
References: <CADArKzXZnFixqw-GRkpwOasYzJRQOE7qH-6XgocG_njvM7EMmA@mail.gmail.com>
Igor ALBUQUERQUE SILVA <i.albuquerque-silva@kayrros.com> writes:
> I'm having a problem regarding the point type/gist indexes. Here's a
> minimal reproduction of it:
> ...
> What I was expecting is the first query to estimate 4 rows and the second
> to estimate 1, like what I get If I try the same thing using integers.
Unfortunately, the selectivity estimation functions for PG's geometric
types are mostly just stubs. The estimation function for point <@ box
in particular is contsel [1]:
/*
* contsel -- How likely is a box to contain (be contained by) a given box?
*
* This is a tighter constraint than "overlap", so produce a smaller
* estimate than areasel does.
*/
Datum
contsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8(0.001);
}
It's been like that (excepting notational changes) since Berkeley days,
because nobody has bothered to make it better.
In general, PG's built-in geometric types have never gotten much
beyond their origins as an academic proof-of-concept. I think people
who are doing serious work that requires such operations mostly use
PostGIS, and I'd suggest looking into that.
Or, if you feel like doing a lot of work to make these estimators
better, have at it.
regards, tom lane
[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/adt/geo_selfunc...
view thread (6+ messages) latest in thread
Message-ID: <1358779.1669828721@sss.pgh.pa.us> Permalink: ../1358779.1669828721@sss.pgh.pa.us/ Also on: postgresql.org/message-id/1358779.1669828721@sss.pgh.pa.us ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-performance@postgresql.org Cc: tgl@sss.pgh.pa.us, i.albuquerque-silva@kayrros.com, pgsql-performance@lists.postgresql.org Subject: Re: Geometric types row estimation In-Reply-To: <1358779.1669828721@sss.pgh.pa.us> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox