Performance/Security question on caching function OIDs for a connection

Поиск
Список
Период
Сортировка
От Weslee Bilodeau
Тема Performance/Security question on caching function OIDs for a connection
Дата
Msg-id 4536928C.6060205@hypermediasystems.com
обсуждение исходный текст
Ответы Re: Performance/Security question on caching function OIDs for a connection
Список pgsql-hackers
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
once?

Weslee


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: [GENERAL] query log corrupted-looking entries
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Performance/Security question on caching function OIDs for a connection