<?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: Amardeep Kumar</title>
    <description>The latest articles on DEV Community by Amardeep Kumar (@amardeepkumar).</description>
    <link>https://dev.to/amardeepkumar</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%2F4120862%2Fbbd35bd1-2a73-4a55-aaa5-2720f2f3f177.jpg</url>
      <title>DEV Community: Amardeep Kumar</title>
      <link>https://dev.to/amardeepkumar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amardeepkumar"/>
    <language>en</language>
    <item>
      <title>Things I learned using DynamoDB (and Athena)</title>
      <dc:creator>Amardeep Kumar</dc:creator>
      <pubDate>Fri, 11 Sep 2026 11:44:00 +0000</pubDate>
      <link>https://dev.to/amardeepkumar/things-i-learned-using-dynamodb-and-athena-4ck9</link>
      <guid>https://dev.to/amardeepkumar/things-i-learned-using-dynamodb-and-athena-4ck9</guid>
      <description>&lt;p&gt;I have been working with DynamoDB for quite some time in our NestJS + TypeScript backend, so this week instead of picking some random topic, I thought I will just write down a few things I actually learned while using it in real features.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Design around your queries, not your data
&lt;/h2&gt;

&lt;p&gt;Coming from SQL, my habit was to normalise everything into separate tables. DynamoDB does not work like that at all. You can only query efficiently using the partition key and sort key. There are no joins, and scanning the whole table is slow and costly.&lt;/p&gt;

&lt;p&gt;So the real skill is to first decide your access patterns, like get item by id, get all transfers of a store, etc, and then design your keys and GSIs (Global Secondary Indexes) around them. For one feature I built recently (a stock transfer module), a single table with 3 GSIs covered every query the app needed - by source store, by destination store and by status. Once you start designing this way, reads stay super fast no matter how big the table grows.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Small data mistakes become big problems
&lt;/h2&gt;

&lt;p&gt;One lesson I learned the hard way - be consistent with data formats. We store dates as ISO strings like &lt;code&gt;2026-09-11T10:30:00.000Z&lt;/code&gt;. Once a date got saved as a numeric epoch timestamp instead, and everything downstream that expected a string (reports, lambdas, views) broke. DynamoDB is schemaless, so nothing stops wrong data from getting in. Basically your application code IS the schema, so validate at write time.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The analytics problem, and Athena
&lt;/h2&gt;

&lt;p&gt;DynamoDB is great for the app, but very bad for questions like how many transactions happened last month grouped by status. There is no SQL, no group by, nothing.&lt;/p&gt;

&lt;p&gt;We solved this with a small pipeline that syncs DynamoDB data to S3 automatically:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;DynamoDB Streams -&amp;gt; Lambda -&amp;gt; SQS -&amp;gt; S3 -&amp;gt; Athena&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Enable streams on the table, so every insert or update sends an event with the new item. A Lambda picks that event and pushes it to SQS, so sudden traffic spikes do not overload anything. Another Lambda writes the records to S3, partitioned by table name. And then Athena lets us run normal SQL directly on those S3 files - joins, group by, everything DynamoDB itself cannot do.&lt;/p&gt;

&lt;p&gt;The best part - to onboard any new table into analytics, we just enable the stream on it. No code changes needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;DynamoDB and SQL databases are not competitors, they solve different problems. Use DynamoDB for fast app queries, and pair it with something like Athena for analytics. And in a schemaless world, discipline about data formats is not optional - it is the schema.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>aws</category>
      <category>backend</category>
      <category>database</category>
    </item>
  </channel>
</rss>
