From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ayo <ayo@blicky.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Custom base type and suboptimal query plans
Date: Tue, 23 Feb 2021 10:24:20 -0500
Message-ID: <3822526.1614093860@sss.pgh.pa.us> (raw)
In-Reply-To: <YDUIvp3QiXjjHPkz@gmai021>
References: <YDUIvp3QiXjjHPkz@gmai021>
Ayo <ayo@blicky.net> writes:
> I have a database where I converted an integer primary key column to a
> custom base type that pretty much amounts to a wrapper around an
> integer, and now some queries are resulting in much slower query plans.
> Does Postgres have special optimizations for integers that are not
> available for custom types, or did I perhaps overlook something?
The slow query isn't using the chars_pkey1 index, which makes one
wonder if you have a corresponding index in the custom-type case,
or if you fat-fingered something about the index operator class
for the custom type. As of v13 I don't think there's anything in
that area that custom types can't replicate ... but there certainly
is plenty of infrastructure for the standard types that you'll need
to build out if you want equivalent functionality.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, ayo@blicky.net
Subject: Re: Custom base type and suboptimal query plans
In-Reply-To: <3822526.1614093860@sss.pgh.pa.us>
References: <YDUIvp3QiXjjHPkz@gmai021> <3822526.1614093860@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