sydent icon indicating copy to clipboard operation
sydent copied to clipboard

ephemeral_public_keys table grows indefinitely

Open anoadragon453 opened this issue 5 years ago • 1 comments

The ephemeral_public_keys table gains a new row whenever a 3pid invite (via email) is sent. The token is sent as part of the email and is validated upon clicking the link.

However, after validation we do not clear the token. While this allows invites to work multiple times (for some reason?) it does lead to an ever-growing table.

It's not unheard of to expire validation emails after a few hours or days, and we should probably do that here.

anoadragon453 avatar Feb 11 '19 18:02 anoadragon453

Stats for vector.im db. Assuming this number is in bytes (sqlite docs just say "Total storage space"), the largest table is 750MB). ephemeral_public_keys is the sixth largest stored thing.

sqlite> SELECT sum(pgsize), name FROM dbstat GROUP BY name ORDER BY sum(pgsize) desc;
sum(pgsize)|name
769774592|invite_tokens
709062656|tokens
608440320|sqlite_autoindex_tokens_1
514449408|invite_token_token
184473600|ephemeral_public_keys_index
181351424|ephemeral_public_keys
118963200|invite_token_medium_address
108321792|global_threepid_associations
31805440|accounts
28598272|sqlite_autoindex_accounts_1
24621056|local_threepid_associations
16984064|accepted_terms_urls_idx
14488576|accepted_terms_urls
10859520|global_threepid_lookup_hash
9791488|global_threepid_medium_address
9785344|local_threepid_medium_address
9160704|global_threepid_medium_lower_address
5345280|global_threepid_originServer_originId
71680|threepid_validation_sessions
20480|threepid_token_auths
12288|threepid_validation_sessions_mtime
8192|sqlite_master
1024|hashing_metadata
1024|name
1024|peer_pubkeys
1024|peername_alg
1024|peers
1024|sqlite_sequence

DMRobertson avatar Nov 11 '21 14:11 DMRobertson