pg_pub_decrypt: 10x performance hit with gpg v2

From: "Felix A(dot) Kater" <fkater(at)posteo(dot)net>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: pg_pub_decrypt: 10x performance hit with gpg v2
Date: 2018-09-18 14:28:18
Message-ID: 20180918142818.GA24012@comppasch2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

pg_pub_decrypt() is ~10x slower when the priv/pub keys have been
generated with gnupg version 2.x instead of version 1.x.

What I do is:
- Create keys with gpg
- Export priv/pub keys
- Store keys in binary form in a bytea
- Create 32 byte random data and encrypt it with pg_pub_encrypt()
- \timing on
- Decrypt with pg_pub_decrypt().

I see ~8ms with v1 keys vs. ~100ms with v2 keys.

I am using defaults everywhere, when generating keys as well as
encrypting with pg_pub_encrypt().

Outside postgresql, I've tested random file encryption/decryption
with gpg 2.x and with both the v1 keys against the v2 keys (both in
the gpg keyring) and cannot detect significant differences.

What can I do to track that issue further down.

Thanks

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2018-09-18 22:21:14 Re: LEFT JOIN LATERAL optimisation at plan time
Previous Message Andrey Zhidenkov 2018-09-18 07:31:08 Performance problems with Thai language