pgsql: Restructure function-internal caching in the range type code. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Restructure function-internal caching in the range type code.
Date
Msg-id E1RQNOq-0001T3-JK@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Restructure function-internal caching in the range type code.

Move the responsibility for caching specialized information about range
types into the type cache, so that the catalog lookups only have to occur
once per session.  Rearrange APIs a bit so that fn_extra caching is
actually effective in the GiST support code.  (Use of OidFunctionCallN is
bad enough for performance in itself, but it also prevents the function
from exploiting fn_extra caching.)

The range I/O functions are still not very bright about caching repeated
lookups, but that seems like material for a separate patch.

Also, avoid unnecessary use of memcpy to fetch/store the range type OID and
flags, and don't use the full range_deserialize machinery when all we need
to see is the flags value.

Also fix API error in range_gist_penalty --- it was failing to set *penalty
for any case involving an empty range.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/37ee4b75db8f979da6d67ba153d068b012394b46

Modified Files
--------------
src/backend/utils/adt/rangetypes.c      |  809 ++++++++++++++-----------------
src/backend/utils/adt/rangetypes_gist.c |  341 ++++++++------
src/backend/utils/cache/typcache.c      |   69 +++
src/include/utils/rangetypes.h          |   69 ++-
src/include/utils/typcache.h            |   14 +
5 files changed, 700 insertions(+), 602 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix alignment and toasting bugs in range types.
Next
From: Tom Lane
Date:
Subject: pgsql: Improve caching in range type I/O functions.