Model First VS Query First

2023-09-26

SQL is a good example of an abstraction that works in most cases (I assume the 80/20 rule is applicable here). But, like most abstractions, it cracks under pressure, and instead of writing readable, well-structured queries, developers find themselves writing dynamic SQL, tweaking indices, and investigating execution plans.

I think query-first data modeling, as used in Apache Cassandra, is more transparent compared to model-first, used in SQL:

  • It doesn't try to hide the physical nature of the query and insists on picking a good index beforehand, thus not faltering under high loads, allowing it to handle huge workloads.
  • It doesn't presume complete data integrity, and thus techniques like partitioning don't seem alien. CQL, for instance, insists on picking a good partition key when modeling your data, presuming partitioning from the beginning.
Subscribe for daily updates on software development, productivity, and more.