<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: vdk0987</title>
    <description>The latest articles on DEV Community by vdk0987 (@vdk0987).</description>
    <link>https://dev.to/vdk0987</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4028995%2F9dae38b2-4016-4aa3-9cf8-e159b22368b5.jpg</url>
      <title>DEV Community: vdk0987</title>
      <link>https://dev.to/vdk0987</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vdk0987"/>
    <language>en</language>
    <item>
      <title>Understanding Data Models: Benefits, Trade-offs, and History</title>
      <dc:creator>vdk0987</dc:creator>
      <pubDate>Tue, 14 Jul 2026 16:40:59 +0000</pubDate>
      <link>https://dev.to/vdk0987/understanding-data-models-benefits-trade-offs-and-history-46dp</link>
      <guid>https://dev.to/vdk0987/understanding-data-models-benefits-trade-offs-and-history-46dp</guid>
      <description>&lt;h2&gt;
  
  
  The Object-Relational Mismatch
&lt;/h2&gt;

&lt;p&gt;Most development takes place in object-oriented programming (OOP) languages, which leads to a common criticism of the SQL data model. If data is stored in relational tables, an awkward translation layer is required between the objects in the application code and the database model of tables, rows, and columns. This is called the &lt;strong&gt;object-relational impedance mismatch&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: LinkedIn Profile
&lt;/h3&gt;

&lt;p&gt;Suppose a LinkedIn profile has a &lt;code&gt;user_id&lt;/code&gt; (primary key). Fields like &lt;code&gt;first_name&lt;/code&gt; and &lt;code&gt;last_name&lt;/code&gt; appear only once per user, but fields like previous jobs and education history can contain multiple entries.&lt;/p&gt;

&lt;p&gt;Traditionally, the most common approach was to create separate tables for jobs and education and link them with the main user table using foreign keys.&lt;/p&gt;

&lt;p&gt;Newer approaches include using structured data types and XML or JSON documents, allowing multiple pieces of related data to exist within a single row. Many databases also support querying and indexing data inside these documents.&lt;/p&gt;

&lt;p&gt;A third option is to encode jobs and education as a JSON or XML document, store it in a text column in the database, and let the application interpret its structure and content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drawback:&lt;/strong&gt; The database cannot query values inside that encoded text column.&lt;/p&gt;

&lt;p&gt;JSON is much better suited for representing a resume.&lt;/p&gt;

&lt;p&gt;It also has much better locality than a multi-table schema. A single query is usually sufficient, whereas in SQL you might need multiple queries or perform messy multi-way &lt;code&gt;JOIN&lt;/code&gt; operations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Many-to-One and Many-to-Many Relationships
&lt;/h2&gt;

&lt;p&gt;Regions, for example, are stored as IDs instead of plain text strings.&lt;/p&gt;

&lt;p&gt;It might seem reasonable to accept and store such information as plain text input. However, storing them as standardized lists of geographic regions and industries, and letting users choose from a dropdown or autocomplete field, provides several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistent style and spelling&lt;/li&gt;
&lt;li&gt;Reduced ambiguity&lt;/li&gt;
&lt;li&gt;Easier updates&lt;/li&gt;
&lt;li&gt;Localization support&lt;/li&gt;
&lt;li&gt;Better search capabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you store an ID such as &lt;strong&gt;"Philanthropy,"&lt;/strong&gt; it exists in only one place. The tuples in the database simply reference it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Are Document Databases Repeating History?
&lt;/h2&gt;

&lt;p&gt;The most popular database in the 1970s was IBM's IMS. It used a hierarchical model, which has remarkable similarities with the JSON document model.&lt;/p&gt;

&lt;p&gt;It worked well for one-to-many relationships but was difficult to maintain for many-to-many relationships, and it did not support &lt;code&gt;JOIN&lt;/code&gt;s.&lt;/p&gt;

&lt;p&gt;Developers had to decide whether to duplicate (denormalize) records or manually resolve references from one record to another.&lt;/p&gt;

&lt;p&gt;The issues faced in the 1960s and 1970s are remarkably similar to those faced by modern developers using document databases today.&lt;/p&gt;

&lt;p&gt;To solve the limitations of IMS, the relational model and the network model were introduced. The relational model succeeded, while the network model eventually faded away.&lt;/p&gt;




&lt;h2&gt;
  
  
  Relational vs. Document Databases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Document databases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Better performance due to data locality&lt;/li&gt;
&lt;li&gt;Greater schema flexibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Relational databases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Native support for &lt;code&gt;JOIN&lt;/code&gt;s&lt;/li&gt;
&lt;li&gt;Better support for many-to-one and many-to-many relationships&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Document models are sometimes called &lt;strong&gt;"schema-less,"&lt;/strong&gt; but that term is misleading. There is still an implicit schema.&lt;/p&gt;

&lt;p&gt;A more accurate term is &lt;strong&gt;schema-on-read&lt;/strong&gt;, where the structure of the data is implicit and only interpreted when the data is read.&lt;/p&gt;




&lt;h2&gt;
  
  
  Data Locality for Queries
&lt;/h2&gt;

&lt;p&gt;A document is usually stored as a single continuous string, encoded as JSON, XML, or a binary format such as BSON.&lt;/p&gt;

&lt;p&gt;If the application frequently needs to access the entire document, this storage locality provides a performance advantage.&lt;/p&gt;

&lt;p&gt;If the same data is split across multiple tables, multiple index lookups are required to retrieve it. This may require additional disk seeks and take more time.&lt;/p&gt;

&lt;p&gt;However, when updating documents, the entire document usually needs to be rewritten. Only modifications that do not change the encoded size can typically be performed in place.&lt;/p&gt;

&lt;p&gt;For this reason, it is generally recommended to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep documents fairly small.&lt;/li&gt;
&lt;li&gt;Avoid updates that increase the size of the document.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Google's Spanner database offers similar locality properties while using a relational data model.&lt;/p&gt;




&lt;h2&gt;
  
  
  Convergence of Document and Relational Databases
&lt;/h2&gt;

&lt;p&gt;Most relational databases (other than MySQL) have supported XML since the mid-2000s. The same is true for JSON support.&lt;/p&gt;

&lt;p&gt;RethinkDB (a document database) supports relational-style &lt;code&gt;JOIN&lt;/code&gt;s in its query language.&lt;/p&gt;

&lt;p&gt;Some MongoDB drivers also automatically resolve database references, effectively performing client-side &lt;code&gt;JOIN&lt;/code&gt;s.&lt;/p&gt;

&lt;p&gt;However, client-side &lt;code&gt;JOIN&lt;/code&gt;s are generally slower than database &lt;code&gt;JOIN&lt;/code&gt;s because they require additional network round trips and cannot benefit from the database's query optimizer.&lt;/p&gt;

</description>
      <category>database</category>
      <category>systemdesign</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
