Ayo <ayo@xxxxxxxxxx> 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