Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Discussion: remove foreign keys #55

Open
i-norden opened this issue Oct 8, 2020 · 0 comments
Open

Discussion: remove foreign keys #55

i-norden opened this issue Oct 8, 2020 · 0 comments

Comments

@i-norden
Copy link
Collaborator

i-norden commented Oct 8, 2020

Pros:

  • Referential integrity enforced inside the database
  • Referential data guarantee can allow a more performant query to be used in some cases
  • CASCADE DELETEs (when used properly to minimize and/or simplify DELETE queries; shift work to the server)
  • Ramil: Referencing by SERIAL (INTEGER) id uses less storage than referencing by 32 byte hashes (VARCHAR(66))

Cons:

  • Performance overhead on INSERTs due to lookup to confirm fk exists
  • Makes sharding the database more difficult
  • Can make testing more difficult as test data must include fk table data
  • CASCADE DELETEs (potential pitfall; developers/operators need to be aware of the side effects of their DELETEs)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant