Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup data from the InvoiceEvents table #5904

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

NicolasDorier
Copy link
Member

@NicolasDorier NicolasDorier commented Apr 5, 2024

This PR save 43% of space in the biggest table in BTCPay Server's schema without deleting any useful data.

An unused 10-byte UniqueId column is included in every line of logs. This column was originally required to satisfy Entity Framework, but by switching to Dapper, we can eliminate it and save 20 bytes per log line (including index and table data).

VACUUM FULL ensures that the space of the removed column is reclaimed by the OS.
ANALYZE ensures that the new index get used.

Table Name Total Size Index Size Table Size
InvoiceEvents2 926 MB 352 MB 573 MB

To

Table Name Total Size Index Size Table Size
InvoiceEvents2 529 MB 42 MB 486 MB

Incidentally, the code is more concise.

@NicolasDorier NicolasDorier added this to the 2.0.0 milestone Apr 19, 2024
@NicolasDorier NicolasDorier merged commit 0c35939 into btcpayserver:master Apr 25, 2024
4 checks passed
@NicolasDorier NicolasDorier deleted the qfpoinw branch April 25, 2024 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant