My Talk from Windy City Rails 2017.
When designing a database for your Ruby on Rails application, what looks like the best solution can be a trap. Join us as we expose these database anti-patterns. We’ll model shoes at a fictional shoe store and show both a naive design and more flexible alternatives. We’ll discuss how to represent trees, and see that the simplest solution is the slowest and hardest to query. We’ll explore scenarios where a polymorphic relationship looks like a good choice, but isn’t (and one where it is). Learn these pitfalls before falling into them, and save yourself from sloppy querying and poor performance.