Re: Custom base type and suboptimal query plans

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ayo <ayo(at)blicky(dot)net>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Custom base type and suboptimal query plans
Date: 2021-02-23 15:24:20
Message-ID: 3822526.1614093860@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ayo <ayo(at)blicky(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-02-23 15:26:57 Re: pg_restore - generated column - not populating
Previous Message Devrim Gündüz 2021-02-23 15:05:23 Re: yum update for postgresql rpms