go
go copied to clipboard
Horizon: Consider dropping duplicated columns from the database schema.
What problem does your feature solve?
Some of the columns represent identical values and are artifacts from earlier migrations. Their names can also be misleading. Examples include:
history_ledgers.transaction_count==history_ledgers.successful_transaction_counthistory_ledgers.operation_countis a subset of (the successful)history_ledgers.tx_set_operation_count
There may be others. This would trim a few hundred MBs (based on some napkin math) from a full-history database after a vacuum.
What would you like to see?
A migration that drops those columns from the database entirely.
What alternatives are there?
We could also drop and rename certain columns. For example,
- rename
operation_count->successful_operation_countand renametx_set_operation_count->operation_count - if we apply the above, we should have the same pattern (track total & successful) for transactions, so do something like drop
transaction_count, lettransaction_count = successful_transaction_count + failed_transaction_count, and dropfailed_transaction_count.
Another alternative is just... not doing this, which means an unnecessary +8 bytes of storage for every new ledger ingested, but that's basically a rounding error for enough history.