Slow query when adding a key
I guess, the thing is that I saw this query in monitoring:
SELECT 1 AS one FROM "keys" WHERE "keys"."key" = 'ssh-rsa BASE64YADDAYADDAYADDA someemail@somehost.com' LIMIT 1
There is no index on key, so this ends up deriving in a table scan. Our guess is that this query comes before adding the key to check that it is not there already.
We could switch this to use the quick fingerprint calculation that we are already using for the /authorized_keys
method and do the validation that way, using an indexed field instead.
cc/ @yorickpeterse