From: Andres Freund Date: Thu, 14 Sep 2017 02:29:45 +0000 (-0700) Subject: WIP: Improve getBaseTypeAndTypemod() performance for builtin types. X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fsimple_statement_perf;p=users%2Fandresfreund%2Fpostgres.git WIP: Improve getBaseTypeAndTypemod() performance for builtin types. Author: Robert Haas Discussion: https://postgr.es/m/ --- diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index b7a14dc87e..2a22da1489 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -2295,6 +2295,9 @@ getBaseTypeAndTypmod(Oid typid, int32 *typmod) HeapTuple tup; Form_pg_type typTup; + if (typid < FirstBootstrapObjectId) + break; + tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid)); if (!HeapTupleIsValid(tup)) elog(ERROR, "cache lookup failed for type %u", typid);