<?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: Prashant Patil</title>
    <description>The latest articles on DEV Community by Prashant Patil (@prashant_patil_49).</description>
    <link>https://dev.to/prashant_patil_49</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3837365%2F9ba3206b-ef1f-45e9-b5f4-cd1973f436a6.png</url>
      <title>DEV Community: Prashant Patil</title>
      <link>https://dev.to/prashant_patil_49</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prashant_patil_49"/>
    <language>en</language>
    <item>
      <title>The SQL Mistake Everyone Makes: Writing vs Execution Order</title>
      <dc:creator>Prashant Patil</dc:creator>
      <pubDate>Mon, 06 Apr 2026 18:25:40 +0000</pubDate>
      <link>https://dev.to/prashant_patil_49/the-sql-mistake-everyone-makes-writing-vs-execution-order-40lf</link>
      <guid>https://dev.to/prashant_patil_49/the-sql-mistake-everyone-makes-writing-vs-execution-order-40lf</guid>
      <description>&lt;p&gt;When I first started learning SQL, my approach was very straightforward. I would begin with the &lt;code&gt;SELECT&lt;/code&gt; statement, list the columns I wanted, add the &lt;code&gt;FROM&lt;/code&gt; clause, and then shape the query based on the problem.&lt;/p&gt;

&lt;p&gt;This worked well for simple queries. However, as problems became more complex, I repeatedly ran into the same issue: I had to rewrite queries from scratch because of small mistakes. This wasted time and slowed down my progress.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;The core issue was simple — I was writing SQL in the order it appears, not in the order it executes.&lt;/p&gt;

&lt;p&gt;Because of this, I:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Applied filters at the wrong stage&lt;/li&gt;
&lt;li&gt;Misused aggregate functions&lt;/li&gt;
&lt;li&gt;Got incorrect results&lt;/li&gt;
&lt;li&gt;Rewrote queries multiple times&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Turning Point
&lt;/h2&gt;

&lt;p&gt;While watching a developer solve multiple SQL problems, I noticed a pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They rarely rewrote queries&lt;/li&gt;
&lt;li&gt;They followed a structured flow&lt;/li&gt;
&lt;li&gt;They thought in terms of execution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is when I realized:&lt;/p&gt;

&lt;p&gt;SQL is not executed in the order we write it.&lt;/p&gt;

&lt;p&gt;Understanding this changed everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL Execution Order
&lt;/h2&gt;

&lt;p&gt;The actual execution order of SQL is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;FROM&lt;/li&gt;
&lt;li&gt;WHERE&lt;/li&gt;
&lt;li&gt;GROUP BY&lt;/li&gt;
&lt;li&gt;HAVING&lt;/li&gt;
&lt;li&gt;SELECT&lt;/li&gt;
&lt;li&gt;DISTINCT&lt;/li&gt;
&lt;li&gt;ORDER BY&lt;/li&gt;
&lt;li&gt;LIMIT&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each step transforms the data before passing it to the next stage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clause Breakdown
&lt;/h2&gt;

&lt;h3&gt;
  
  
  FROM
&lt;/h3&gt;

&lt;p&gt;Selects the base table and performs joins.&lt;/p&gt;

&lt;h3&gt;
  
  
  WHERE
&lt;/h3&gt;

&lt;p&gt;Filters rows before grouping.&lt;/p&gt;

&lt;h3&gt;
  
  
  GROUP BY
&lt;/h3&gt;

&lt;p&gt;Groups rows based on column values.&lt;/p&gt;

&lt;h3&gt;
  
  
  HAVING
&lt;/h3&gt;

&lt;p&gt;Filters grouped data.&lt;/p&gt;

&lt;h3&gt;
  
  
  SELECT
&lt;/h3&gt;

&lt;p&gt;Chooses columns and applies calculations.&lt;/p&gt;

&lt;h3&gt;
  
  
  DISTINCT
&lt;/h3&gt;

&lt;p&gt;Removes duplicates.&lt;/p&gt;

&lt;h3&gt;
  
  
  ORDER BY
&lt;/h3&gt;

&lt;p&gt;Sorts results.&lt;/p&gt;

&lt;h3&gt;
  
  
  LIMIT
&lt;/h3&gt;

&lt;p&gt;Restricts number of rows returned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Table: orders
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;order_id&lt;/th&gt;
&lt;th&gt;customer&lt;/th&gt;
&lt;th&gt;amount&lt;/th&gt;
&lt;th&gt;city&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;Pune&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;Mumbai&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;150&lt;/td&gt;
&lt;td&gt;Pune&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;Delhi&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;250&lt;/td&gt;
&lt;td&gt;Mumbai&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Problem
&lt;/h3&gt;

&lt;p&gt;Find total order amount per city where total &amp;gt; 200 and sort descending.&lt;/p&gt;

&lt;h3&gt;
  
  
  Query
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_amount&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;
&lt;span class="k"&gt;HAVING&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;total_amount&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Execution Walkthrough
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: FROM
&lt;/h3&gt;

&lt;p&gt;All rows are selected.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: WHERE
&lt;/h3&gt;

&lt;p&gt;Filter &lt;code&gt;amount &amp;gt; 100&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Remaining rows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mumbai: 200, 250&lt;/li&gt;
&lt;li&gt;Pune: 150&lt;/li&gt;
&lt;li&gt;Delhi: 300&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: GROUP BY
&lt;/h3&gt;

&lt;p&gt;Groups formed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mumbai&lt;/li&gt;
&lt;li&gt;Pune&lt;/li&gt;
&lt;li&gt;Delhi&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 4: HAVING
&lt;/h3&gt;

&lt;p&gt;Filter groups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mumbai (450) -&amp;gt; keep&lt;/li&gt;
&lt;li&gt;Pune (150) -&amp;gt; remove&lt;/li&gt;
&lt;li&gt;Delhi (300) -&amp;gt; keep&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: SELECT
&lt;/h3&gt;

&lt;p&gt;Result:&lt;br&gt;
| city   | total_amount |&lt;br&gt;
|--------|-------------|&lt;br&gt;
| Mumbai | 450         |&lt;br&gt;
| Delhi  | 300         |&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: ORDER BY
&lt;/h3&gt;

&lt;p&gt;Sorted descending:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mumbai&lt;/li&gt;
&lt;li&gt;Delhi&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Do not think in terms of writing SQL.&lt;/p&gt;

&lt;p&gt;Think in terms of execution.&lt;/p&gt;

&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce errors&lt;/li&gt;
&lt;li&gt;Improve speed&lt;/li&gt;
&lt;li&gt;Help solve complex queries&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Understanding SQL execution order is a fundamental skill. Once you start thinking in execution steps instead of syntax order, your ability to write efficient and correct queries improves significantly.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>dbms</category>
      <category>database</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Why Deleting `node_modules` Takes Forever on Windows</title>
      <dc:creator>Prashant Patil</dc:creator>
      <pubDate>Sat, 21 Mar 2026 16:56:18 +0000</pubDate>
      <link>https://dev.to/prashant_patil_49/why-deleting-nodemodules-takes-forever-on-windows-1h73</link>
      <guid>https://dev.to/prashant_patil_49/why-deleting-nodemodules-takes-forever-on-windows-1h73</guid>
      <description>&lt;p&gt;A few days ago, I was deleting a project when something unexpectedly frustrating happened — it took way too long.&lt;/p&gt;

&lt;p&gt;Not seconds. Not even a minute. It just kept going.&lt;/p&gt;

&lt;p&gt;If you’ve worked with JavaScript projects, you already know the culprit: &lt;code&gt;node_modules&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That moment got me thinking. Since I’ve been studying operating system fundamentals, I wanted to understand what’s actually happening behind the scenes. Why does a simple delete operation take so long?&lt;/p&gt;

&lt;p&gt;So I went down the rabbit hole — digging through documentation, GitHub discussions, and system-level explanations. I even explored how Linux handles file deletion to compare behaviors.&lt;/p&gt;

&lt;p&gt;Here’s what I found.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Real Reason Isn’t Just “Too Many Files”
&lt;/h2&gt;

&lt;p&gt;Yes, &lt;code&gt;node_modules&lt;/code&gt; contains thousands of files — sometimes hundreds of thousands.&lt;/p&gt;

&lt;p&gt;But that’s only part of the story.&lt;/p&gt;

&lt;p&gt;The real reason deletion is slow on Windows comes down to how the operating system handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File system operations
&lt;/li&gt;
&lt;li&gt;Security checks
&lt;/li&gt;
&lt;li&gt;Path resolution
&lt;/li&gt;
&lt;li&gt;File locking
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s break it down.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Windows Deletes Files One by One
&lt;/h2&gt;

&lt;p&gt;Unlike what many people assume, Windows does not delete folders in bulk.&lt;/p&gt;

&lt;p&gt;Instead, it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Traverses every directory
&lt;/li&gt;
&lt;li&gt;Deletes each file individually
&lt;/li&gt;
&lt;li&gt;Updates metadata for every operation
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now imagine doing that for 100,000+ files.&lt;/p&gt;

&lt;p&gt;That alone creates noticeable delay.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. File Locking Adds Extra Overhead
&lt;/h2&gt;

&lt;p&gt;Windows uses a strict file locking mechanism.&lt;/p&gt;

&lt;p&gt;Before deleting a file, it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checks whether the file is in use
&lt;/li&gt;
&lt;li&gt;Verifies parent directories
&lt;/li&gt;
&lt;li&gt;Temporarily locks parts of the directory structure
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If anything is being accessed — even indirectly — the system slows down or retries the operation.&lt;/p&gt;

&lt;p&gt;This adds friction, especially in deeply nested folders like &lt;code&gt;node_modules&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Windows Defender Is the Biggest Bottleneck
&lt;/h2&gt;

&lt;p&gt;This is where most of the time actually goes.&lt;/p&gt;

&lt;p&gt;Windows Defender scans files not just when they’re created or opened — but also when they’re deleted.&lt;/p&gt;

&lt;p&gt;That might sound unnecessary, but there’s a reason.&lt;/p&gt;

&lt;p&gt;Malware can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create harmful files
&lt;/li&gt;
&lt;li&gt;Execute them
&lt;/li&gt;
&lt;li&gt;Delete them quickly to avoid detection
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To prevent this, Windows scans files during deletion as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In many cases, 60–70% of the total deletion time is spent on Defender scans alone.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Long File Paths Make Things Worse
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;node_modules&lt;/code&gt; often contains deeply nested dependencies.&lt;/p&gt;

&lt;p&gt;This leads to extremely long file paths.&lt;/p&gt;

&lt;p&gt;Windows has historically had a path length limit (~260 characters). Even though modern systems support longer paths, many tools still struggle with them.&lt;/p&gt;

&lt;p&gt;When paths exceed limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operations can fail
&lt;/li&gt;
&lt;li&gt;Windows retries them silently
&lt;/li&gt;
&lt;li&gt;Additional time is wasted
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. NTFS File System Overhead
&lt;/h2&gt;

&lt;p&gt;Windows uses the NTFS file system, which prioritizes reliability and consistency.&lt;/p&gt;

&lt;p&gt;For every file deletion, NTFS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updates logs
&lt;/li&gt;
&lt;li&gt;Maintains metadata
&lt;/li&gt;
&lt;li&gt;Ensures file system integrity
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Doing this for thousands of files significantly slows things down.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Linux and macOS Handle It Differently
&lt;/h2&gt;

&lt;p&gt;Unix-based systems take a much simpler and faster approach.&lt;/p&gt;

&lt;p&gt;They:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid heavy antivirus scanning during deletion
&lt;/li&gt;
&lt;li&gt;Use more efficient file unlinking mechanisms
&lt;/li&gt;
&lt;li&gt;Have fewer restrictions on file paths
&lt;/li&gt;
&lt;li&gt;Use a more flexible file locking model
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is a noticeable difference in performance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Quick Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Windows (NTFS)&lt;/th&gt;
&lt;th&gt;Linux/macOS (ext4/APFS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File Deletion&lt;/td&gt;
&lt;td&gt;File-by-file with checks&lt;/td&gt;
&lt;td&gt;Faster unlinking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Antivirus&lt;/td&gt;
&lt;td&gt;Scans during deletion&lt;/td&gt;
&lt;td&gt;Typically no scan&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Path Limits&lt;/td&gt;
&lt;td&gt;Historically restrictive&lt;/td&gt;
&lt;td&gt;More flexible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File Locking&lt;/td&gt;
&lt;td&gt;Strict&lt;/td&gt;
&lt;td&gt;More relaxed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance on &lt;code&gt;node_modules&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;td&gt;Significantly faster&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Why Windows Prioritizes Safety
&lt;/h2&gt;

&lt;p&gt;At this point, it’s fair to ask: why does Windows do all this?&lt;/p&gt;

&lt;p&gt;The answer is simple — security.&lt;/p&gt;

&lt;p&gt;Without these checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Malware could create and delete files instantly
&lt;/li&gt;
&lt;li&gt;Those files might never be scanned
&lt;/li&gt;
&lt;li&gt;The system could be compromised silently
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So while it feels inefficient, it’s a deliberate design decision.&lt;/p&gt;




&lt;h2&gt;
  
  
  Can You Speed It Up?
&lt;/h2&gt;

&lt;p&gt;Yes — but every shortcut comes with trade-offs.&lt;/p&gt;

&lt;p&gt;Some practical options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like &lt;code&gt;rimraf&lt;/code&gt; for faster deletion
&lt;/li&gt;
&lt;li&gt;Enable long path support in Windows
&lt;/li&gt;
&lt;li&gt;Use WSL (Windows Subsystem for Linux) for development workflows
&lt;/li&gt;
&lt;li&gt;Avoid reinstalling dependencies unnecessarily
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also disable real-time antivirus scanning temporarily, but that introduces risk and isn’t advisable for regular use.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Deleting &lt;code&gt;node_modules&lt;/code&gt; slowly on Windows isn’t a bug — it’s the result of intentional system design.&lt;/p&gt;

&lt;p&gt;Windows favors safety and control.&lt;br&gt;&lt;br&gt;
Unix-based systems favor speed and simplicity.&lt;/p&gt;

&lt;p&gt;Once you understand that trade-off, the behavior makes a lot more sense — even if it’s still frustrating.&lt;/p&gt;

</description>
      <category>microsoft</category>
      <category>discuss</category>
      <category>learning</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
