IntersectMBO / cardano-db-sync

A component that follows the Cardano chain and stores blocks and transactions in PostgreSQL
Apache License 2.0
293 stars 161 forks source link

Drop redeemer_id references #1746

Open kderme opened 4 months ago

kderme commented 4 months ago

A redeemer can have 6 types: spend, mint, cert, reward, vote, propose, which is depicted in the redeemer.purpose field. This field with the redeemer.tx_id and redeemer.index, identifies uniquely a redeemer and it's relation to another table spend -> tx_in mint -> ma_tx_mint cert -> delegation or stake_deregistration reward -> withdrawal vote -> delegation_vote propose -> gov_action_proposal

In addition to that, the schema also provides the reverse relations tx_in.redeemer_id stake_deregistration.redeemer_id delegation_redeemer_id (ma_tx_mint doesn't have a redeemer_id reference) withdrawal_redeemer_id delegation_vote.redeemer_id (gov_action_proposal doesn't have a redeemer_id reference)

The motivation of these were to make it easier to identify which entries have an attached redeemer, but they are duplicate data. Other than that, they complicate parallelising the workload of db-sync since they create dependencies within the insertion of a block.

sgillespie commented 3 months ago

Discord discussion: https://discord.com/channels/1136727663583698984/1239888910537064468/1257039445249491024