]> granicus.if.org Git - postgresql/commit
Restructure function-internal caching in the range type code.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Nov 2011 18:05:45 +0000 (13:05 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Nov 2011 18:05:45 +0000 (13:05 -0500)
commit37ee4b75db8f979da6d67ba153d068b012394b46
treeb888127287d4f1b06d34cd57ec9dba8cf40a62b1
parentad50934eaadb626de682defe0ad270bbf31e92a2
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.
src/backend/utils/adt/rangetypes.c
src/backend/utils/adt/rangetypes_gist.c
src/backend/utils/cache/typcache.c
src/include/utils/rangetypes.h
src/include/utils/typcache.h