I'm working on my custom encryption types (as outlined in another
thread) and was curious of one potential performance hit.

On the input and output functions for the new type, I lookup the
encrypt/decrypt functions using -

        FuncnameGetCandidates( list_make1( makeString( "decrypt" ) )

Running through the list and getting the functions OID, then calling
with OidFunctionCall3().

I'm concerned about the performance impact if say, importing thousands
of rows in a COPY, doing the lookup for every row. To get around this I
was thinking of doing the lookup once then caching the OIDs for the
functions (a per-connection cache, not globally).

I know the function can be dropped, I'm trapping the error so I'm not as
concerned, but is it possible for someone to replace the same OID with
another function?

My thoughts were if the call failed, perform another lookup for the new
OID, if it can't be found error out. But if the OID just points to a new
function it may not generate an error and just return something unexpected.

I'm not sure if its safe, or if I shouldn't even bother trying to cache
for performance?

I know it makes little difference when inserting one row as encryption
takes the bulk of the time, but when you scale to thousands+ inserts at


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?


Reply via email to