Startup Mistakes: Choice of Datastore
Wow. This fell off the front page in the time it took for me to drive to work. Guess the NoSQL crowd ain&#x27;t got time for that.<p>While I&#x27;m generally sympathetic to your post, there are some things that are red flags.<p>&gt;If you have ten services accessing the same database and sharing data between themselves<p>Whoever access the database schema owns it. If you have ten systems accessing your database then ten teams own it. And if ten teams own it then nobody owns it. Nobody can change it. Seen this at a successful start-up that got big, but then couldn&#x27;t rev order management, because every team had their finger in the pie, we couldn&#x27;t do a schema update without breaking everyone, and of course one team was &quot;under tremendous pressure to hit a major milestone and we just can&#x27;t do that now&quot; for over a year.<p>Now I would turn this around into a win for RDBMS by suggesting the use of functions or stored procedures: with an RDBMS we can construct an API, and then we can version those APIs. And then the team that owns the database can do what they like. That said, we can do the same with NoSQL databases by not allowing other teams to access them. The team that owns the NoSQL database is required to maintain an API for it.<p>I&#x27;ve only ever had nightmares with other teams coding against my schema. GraphQL worries me in that respect and I&#x27;d love to hear how people here have fared with long lasting GraphQL, in the real world.<p>&gt;Django, for example, makes migrations trivial, as you just change your application-level classes and the database gets migrated automatically.<p>I&#x27;ve had automated migration systems grind to a halt and leave the DB fucked too.<p>&gt;Priscilla used a graph database when her data was relational. Her husband, furious, filed for divorce.<p>There are no schema that are &quot;relational&quot; but not &quot;a graph&quot;. However there are plenty of schema where a graph database is a natural fit but that require either one-table-per-node-type or building a graph model on top of your RDBMS (e.g. an Entity-Attribute schema). Oy.<p>There are also many schema where there is only one entity type, but every join is against itself, and we&#x27;re looking to join all the way out to the clique. In this case would you suggest an RDBMS, and then put the iteration in the application? You suggested earlier that making up for the inadequacies of the datastore in the application is a bad idea.<p>I&#x27;ve got a graph application that uses NoSQL and it was the right call. An RDBMS would have allowed us to write something that worked for simple cases, but that would have brought the system to its knees based on some customer usage. The solution for the RDBMS would be the same as what we had to do for NoSQL. But up to that moment, the NoSQL allowed us to iterate far faster than an RDBMS.<p>&gt;For example, if you later need to compile a list of all the brands of all the products on your store, an RDBMS can easily do that by reading the “brands” table<p>Only if you built a brands table. You can&#x27;t argue that we can&#x27;t predict the future, so use an RDBS because its easy to change, but then make arguments that require that the builder accurately predicted the future and built the schema with that foresight. Sure, we could go and pull a brands table out of the existing tables but thats work, and it might be work on a live database that brings it down.<p>A graph database would be just as likely to have 10 brand nodes since the overhead of creating the first such node is far lower than creating an entire table and updating the schema.<p>&gt;Relational databases excel at easily providing answers to questions that weren’t predicted at the time when the data model was designed.<p>Or a NoSQL database with spark. &quot;But spark is something new to learn&quot;<p>And this is the biggest flaw in your argument. You&#x27;re pro RDBMS because you know SQL and how to run RDBMS, create the schema, and write the queries. It is incredibly easy to get started with MongoDB. That right there is why it is popular. Not because its good. But when you say &quot;Just get something started and use an RDBMS&quot;, you&#x27;re actually saying &quot;I know you know javascript, but I need you to learn Modula-2 for this part of the system&quot;. Fundamentally different syntax and strict types (or &quot;schema&quot;).<p>&gt;For all its unparallelizability, ACID is pretty damn nice.<p>Until someone holds transactions open across network calls and kills throughput. I&#x27;ve seen that issue lose a company a multi-million dollar contract because of contention on a single row. Or until someone chooses the wrong isolation level (&quot;But I used a transaction!&quot;) and two transactions happily decrement non-atomically. This shit be hard, and part of the &quot;hard&quot; is not knowing you&#x27;re doing it wrong.<p>&gt;You’ll have plenty of time figuring out what to use when you know your exact usage patterns, if the business manages to not die until then.<p>So start with something quick and easy then. You&#x27;ve already managed to describe two scenarios where an RDBMS blew up in practice (multiple teams hitting a DB causing schema lock; its a network, not a flat hierarchy).<p>If you have an experienced SQL team, by all means go with RDBMS. But lets not pretend they are a panacea. Honestly, I&#x27;d use a graph database pretty much all the time - <i>if I could only trust them</i>. But its the quality, reliability and longevity that I have a problem with, not with the nature of how the database organizes data.