<?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: Mohammad Mahabub Alam</title>
    <description>The latest articles on DEV Community by Mohammad Mahabub Alam (@mahabubalam3004).</description>
    <link>https://dev.to/mahabubalam3004</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%2F3967799%2F0217d5d2-06ea-4e6c-a821-38b4914d56db.png</url>
      <title>DEV Community: Mohammad Mahabub Alam</title>
      <link>https://dev.to/mahabubalam3004</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahabubalam3004"/>
    <language>en</language>
    <item>
      <title>Introduction -&gt; RAG</title>
      <dc:creator>Mohammad Mahabub Alam</dc:creator>
      <pubDate>Fri, 10 Jul 2026 12:44:24 +0000</pubDate>
      <link>https://dev.to/mahabubalam3004/introduction-rag-326j</link>
      <guid>https://dev.to/mahabubalam3004/introduction-rag-326j</guid>
      <description>&lt;h2&gt;
  
  
  What is RAG?
&lt;/h2&gt;

&lt;p&gt;Formal Defination: Retrieval Augmented Generator it is an AI framework that improves the accuracy of LLM's by fetching facts from an external authoritative knowledge base before generating a response. It prevents the AI from "hallucinating"(making the facts by it's own doesn't matter the fact is false) and provides up to date, domain specific answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why RAG shows up in AI eco system?
&lt;/h2&gt;

&lt;p&gt;Okay, let's talk about without RAG. So we use AI for our day to day life, in  different domains. LLM's are trained on the real world data. But as you know in our day to day life every second new data produce and the size of those data is humongous. Now based on the that humongous data if the companies try to update their LLM models than their will be chaos because to trained LLM models we need a lot of computing power and other things. So it is not possible now to trained LLM's based on real time data. Their is a term for this situation which is "Knowledge cutoff".&lt;/p&gt;

&lt;p&gt;Now in your mind a question might arise, that so if they can not trained models with real time data than how can it gives response to question related to present time? &lt;/p&gt;

&lt;p&gt;Here enters the RAG (Retrieval Augmented Generator). So let's talk about what RAG actually do. So at first when you give AI a prompt related to present time, where the LLM's are not trained yet with present time data. So instead of giving the response to the user, LLM calls tools to get information from the internet. For example you prompt this "What is the weather today in Dhaka? ". So here present time comes in so LLM's are smart enough and it detects that user wants to know about present day weather information, so it has some tools, it uses them to get the data from the internet in current time and in this way it is able to get the real time data. This all happens by using RAG framework.&lt;/p&gt;

&lt;p&gt;Now you have the idea about RAG, we can go to the simple architecture of RAG: &lt;/p&gt;

&lt;p&gt;So basically in RAG there are two pipelines present:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Indexing phrase&lt;/li&gt;
&lt;li&gt;Query phrase&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Indexing phrase:
&lt;/h2&gt;

&lt;p&gt;In indexing phrase these steps are followed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text to Chunk&lt;/li&gt;
&lt;li&gt;Chunk to vector embedding&lt;/li&gt;
&lt;li&gt;Store chunk and vector embedding into a vector db.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's explore each steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Text to chunk&lt;br&gt;
First text to chunk it means that text is basically the prompt, docs, files etc that user provides. Suppose user give some pdf's and later based on these pdf's user will asked questions. So now on the pdf all the texts will divided into small small pieces and each piece is basically called a chunk. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chunk to vector embedding&lt;br&gt;
We have chunks but these chunks does not mean anything, so to give meaning to each chunk we use vector embedding. After doing the vector embedding we have the real world meaning about each chunk. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Store chunk and vector embedding in vector db&lt;br&gt;
After getting the meaning of each chunk now we need to store those chunks with vector embedding so that in the query phrase where user pass any query it can go through all the meaning and select the closest one and based on that chunk it can perform next things. So there are so many vector databases present to store the vector embeddings with chunk. So we store the chunks and meaning to a db.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Query phrase:
&lt;/h2&gt;

&lt;p&gt;In query phrase these steps are followed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User text to Chunk&lt;/li&gt;
&lt;li&gt;Chunk to vector embedding&lt;/li&gt;
&lt;li&gt;Similarity query search in the vectorDB.&lt;/li&gt;
&lt;li&gt;Chunk retrieved from vectorDB.&lt;/li&gt;
&lt;li&gt;Send user query and retrieved chunks to the LLM as system prompt.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's explore each steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;User text to Chunk:&lt;br&gt;&lt;br&gt;
Just like indexing phrase here also user query or say prompt or text convert into chunks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chunk to vector embedding:&lt;br&gt;
Same as indexing phrase. To  give mathematical meaning to the chunks we go through vector embedding. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Similarity query search in the vectorDB:&lt;br&gt;
We have the user query chunk and it's mathematical meaning we can search the vectorDB to find that, is there any close to user query vector meaning  find in the db. Only this thing is done here. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chunk retrieved from VectorDB:&lt;br&gt;
Here the similar chunks retrieved from the db. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Send user query and retrieved chunks to the LLM as system prompt:&lt;br&gt;
Here the user query and the chunks that are retrieved from the DB send to the LLM models as a system prompt. So the LLM have the context and based on the user query give response to it. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9brwyfoelmszh4c522np.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9brwyfoelmszh4c522np.png" alt="RAG system diagram" width="800" height="459"&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;Image credit: &lt;a href="https://dev.to/piyushgarg_dev"&gt;Piyush Garg&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Common scenarios where RAG works well
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For students or any learning professionals if they wants to ask questions or find topics from big pdf's than RAG can be used, where user can upload files and based on those files student can asked the agent related questions. Now the agent will have a good reference and it will also look to it's trained data to give a solid answer, which will help the student to understand the topic more better.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Employees waste their most of the time searching something in docs, pdf's, files, chats etc.So a RAG system can be introduced which will decrease the time needed for searching stuffs and employee can focus on more to solve the real problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Privacy policies search: Most of the time users are not interested to read the privacy policies of a website or company because of the long listed paragraphs and the number of pages there in the policy section. So there can be RAG introduced so that it can read the policies and than user can asked questions about the policies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Financial Analysis: In financial sectors there are lots of documents and reports. Until now all the documents need to check at a time which takes a lot of time and also man power also money. So if we use RAG here user can uploads documents and then the agents will go through the documents and answer the user questions. Also it can remember that where which data is place like page number etc which makes easier for user to find out correct things in correct place.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Education area: In all online courses each course contains many videos. So if someone wants to learn something or look at some specific topic he have to go through so many videos. Sometimes he get will found the topics he is looking for but most of the time didn't get the desired topic which makes learning more difficult,if student wants to go through some topics he can not. So if we use RAG here we can help students to find their desired topic and also able to give them exact time stamp and video number which will make the study more reliable and more enjoyable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  RAG issues
&lt;/h2&gt;

&lt;p&gt;If the agent have incorrect data than it will give incorrect answers. Because it takes context or idea based on incorrect data. We human have the capability to understand corrupt or say unstructured data which is not possible for the LLM models. Also there is a limitation of memory it can have. If you give a huge data set into the context than it started hallucinating as a result it gives wrong answers with full confident. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why issues arise?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Poor retrieval: Poor retrieval simply means that retriever found documents, but they are the wrong ones. 
For example: You provide documents about "how to reset password in facebook" but you give this prompt "how can i reset my linkedin password?" now the LLM will give you response based on that provided documents which will be related to facebook password reset but you want for linkedin.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why poor retrieval happens:&lt;/strong&gt; &lt;br&gt;
  -&amp;gt;Bad embedding : Embedding is basically converts text into vectors. If two related sentences end up far a part in that 3D vector space than similarity search fails. For example: You give a document which contains "How to reset your fb password." but the user query is "I forgot my fb password." Now if bad embedding happens than the "reset password" and "forgot password" the distance between them will be so far that the model can not make a proper similarity match between them, as a result the model will not understand the user query. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Poor Chunking: In the RAG their is a phrase where the text converted into small chunks. Now if these chunks divided in a way were in each chunk there is no connection between other chunks than it will be a reason for bad response.
For example: Suppose your document is this: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 1:&lt;br&gt;
Go to settings&lt;br&gt;
Click password&lt;br&gt;
Enter new password&lt;/p&gt;

&lt;p&gt;now when after you provide this document and the chunking is like this: &lt;/p&gt;

&lt;p&gt;Chunk A: Step 1:&lt;br&gt;
         Go to settings&lt;/p&gt;

&lt;p&gt;Chunk B: Click password&lt;/p&gt;

&lt;p&gt;Chunk C: Enter new password &lt;/p&gt;

&lt;p&gt;Now if the chunks are in this way than if the retriever retrieve chunk C than the LLM will get "Enter new password" but it has no idea where to go as a result it can not provide a good response to the user because the LLM itself don't know where to go.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing context: It means the retriever actually found the correct document but the information provided is incomplete.
For example: User provide a document which contains all the ingredients name and the portion numbers, but it doesn't contain anything related to "how to make biryani?" and if the user query is like "tell me how to cook biryani?" that time for missing the context the agent response will be incomplete or wrong.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>llm</category>
    </item>
    <item>
      <title>Generative AI: What Happens When You Type a Prompt?</title>
      <dc:creator>Mohammad Mahabub Alam</dc:creator>
      <pubDate>Wed, 01 Jul 2026 18:28:30 +0000</pubDate>
      <link>https://dev.to/mahabubalam3004/generative-ai-what-happens-when-you-type-a-prompt-4po7</link>
      <guid>https://dev.to/mahabubalam3004/generative-ai-what-happens-when-you-type-a-prompt-4po7</guid>
      <description>&lt;p&gt;If you’ve used ChatGPT, Claude, or Gemini recently, you’ve witnessed a minor miracle. You type a messy, half-formed thought in plain English, and a few seconds later, you get a coherent, context-aware response. It feels like you're talking to a incredibly well-read human who lives inside your screen.&lt;br&gt;
But beneath the sleek user interface lies a fascinating machinery of math, statistics, and linguistic translation. Because here is the ultimate plot twist of the AI revolution: &lt;strong&gt;computers still don’t understand a single word of human language.&lt;/strong&gt;&lt;br&gt;
If you are a JavaScript developer looking to build with Generative AI, or just someone curious about how these models actually tick, you need to understand the pipeline. Let’s pull back the curtain on what happens between hitting "Enter" and seeing that flashing cursor generate your answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Demystifying the LLM
&lt;/h2&gt;

&lt;p&gt;Before looking at the mechanics, let's define the core engine: the &lt;strong&gt;LLM&lt;/strong&gt;, or &lt;strong&gt;Large Language Model&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Large:&lt;/strong&gt; Refers to the scale. These models are trained on massive datasets (essentially the public internet, books, and articles) and contain billions of internal settings called "parameters."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language:&lt;/strong&gt; Their domain of expertise. They are built to process, predict, and generate human-like text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model:&lt;/strong&gt; A mathematical representation of patterns learned from data.
### The Problems LLMs Solve
Traditionally, coding an application to understand human intent meant writing endless chains of if/else statements, regex patterns, or complex sentiment analysis rules. Even then, a typo could break the system. LLMs solve the problem of &lt;strong&gt;unstructured data&lt;/strong&gt;. They can parse chaotic, unstructured human text and extract meaning, summarize it, or transform it into structured formats like JSON.
### LLMs in the Wild
You encounter these models daily through popular examples like:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI's GPT-4o&lt;/strong&gt; (powering ChatGPT)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google's Gemini&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Anthropic's Claude&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meta's Llama&lt;/strong&gt; (an open-source model you can run locally)
Beyond chatbots, they power features you might take for granted: email autocomplete, real-time language translation, IDE code suggestions (like GitHub Copilot), and automated customer support lines that actually solve your problem.
## 2. Why Computers Don't Speak Human
To understand the workflow, we have to address a fundamental limitation of computers.
Computers are, at their core, glorified calculators. They operate entirely on binary, logic gates, and math. They excel at processing numbers but have absolutely no concept of what the letter "A," the word "apple," or the concept of "existential dread" means.
To bridge this gap, everything we type must be converted into numerical values before an AI can touch it. If you feed raw English text into a machine learning model, it’s the equivalent of pouring sand into a car's engine.
To turn text into math, the AI uses a process called &lt;strong&gt;Tokenization&lt;/strong&gt;.
## 3. Tokenization: Breaking Down the Words
Before an LLM reads your prompt, a specialized piece of software called a &lt;strong&gt;tokenizer&lt;/strong&gt; chops your sentence into bite-sized pieces called &lt;strong&gt;tokens&lt;/strong&gt;.
&amp;gt; &lt;strong&gt;What is a Token?&lt;/strong&gt; &amp;gt; A token is the basic unit of text that an AI reads. It isn’t always a whole word. It can be a single character, a syllable, part of a word, or even punctuation marks.
&amp;gt; 
### Why not just use whole words?
If an AI mapped every single unique word in human history to a number, the vocabulary list would be impossibly massive and rigid. It would struggle with new slang, typos, or compounded words. By breaking text into sub-words, the AI can understand entirely new words just by looking at their pieces.
As a general rule of thumb, &lt;strong&gt;1 token is roughly equal to 4 characters, or about 0.75 words&lt;/strong&gt; in English.
### A Visualizing Example
Take the sentence: "Coding in JS is fantastic."
A tokenizer might break it down like this:
["Cod", "ing", " in", " JS", " is", " fan", "tastic", "."]
Each of these distinct fragments is assigned a specific ID number from a massive pre-defined dictionary.&lt;/li&gt;
&lt;li&gt;"Cod" might become 412&lt;/li&gt;
&lt;li&gt;"ing" might become 102&lt;/li&gt;
&lt;li&gt;" JS" might become 8453
By the time the AI receives your input, it isn’t reading your words; it’s reading an array of integers: [412, 102, 8453, ...].
## 4. The Brain Inside: The Transformer
Once your prompt is a sequence of numbers, it enters the core architecture of modern AI: the &lt;strong&gt;Transformer&lt;/strong&gt;.
Introduced by Google researchers in a groundbreaking 2017 paper titled &lt;em&gt;"Attention Is All You Need,"&lt;/em&gt; the Transformer architecture completely revolutionized how machines process language. Before Transformers, AI read sentences sequentially—word by word. If a sentence was too long, it forgot how it started by the time it reached the end.
Transformers changed everything using a mechanism called &lt;strong&gt;Self-Attention&lt;/strong&gt;.
### How Transformers Understand Context
Self-attention allows the model to look at a word and instantly look at &lt;em&gt;every other word&lt;/em&gt; in the sentence to figure out its exact meaning.
Consider these two sentences:&lt;/li&gt;
&lt;li&gt;"The &lt;strong&gt;bank&lt;/strong&gt; of the river was muddy."&lt;/li&gt;
&lt;li&gt;"The money is safely deposited in the &lt;strong&gt;bank&lt;/strong&gt;."
As a human, you easily deduce the meaning of "bank" from the surrounding words ("river" vs "money"). A Transformer does exactly this mathematically. It calculates relationships between all the tokens in your prompt simultaneously, building a rich map of context.
This architectural breakthrough is why almost every major LLM today—from GPT to Claude—has a "T" in its name or uses Transformers under the hood. It allows the AI to grasp nuance, sarcasm, and complex instructions over incredibly long stretches of text.
## 5. What Happens When You Send a Message? (The High-Level Workflow)
Let’s piece the whole assembly line together. What actually happens when you type a prompt into ChatGPT and hit send?
### Step 1: The Input (Typing the Prompt)
You submit your text. Along with your visible message, the system often injects hidden developer instructions (called a System Prompt) behind the scenes, such as &lt;em&gt;"You are a helpful programming assistant that writes clean JavaScript."&lt;/em&gt;
### Step 2: Tokenization &amp;amp; Mapping
Your text is converted into token IDs. These IDs are then translated into vectors (long lists of numbers) that represent where that token sits in a multi-dimensional "meaning space."
### Step 3: Processing inside the Transformer
The numerical data passes through dozens of layers of the Transformer network. The model weighs the tokens against each other using self-attention, figuring out the intent of your question and what information matters most.
### Step 4: Generation (Predicting the Next Token)
Here is the big secret: &lt;strong&gt;LLMs do not copy and paste answers from a database or search engine.&lt;/strong&gt; They don’t "know" facts the way a human encyclopedian does.
Instead, an LLM is an incredibly sophisticated &lt;strong&gt;next-token predictor&lt;/strong&gt;.
Based on your prompt, it calculates a probability distribution for what token should come next. If your prompt is &lt;em&gt;"The sky is..."&lt;/em&gt;, the model evaluates its training data and decides there is a 95% chance the next token should be " blue", a 2% chance it's " cloudy", and a 0.1% chance it's " soup".
It selects the best token, appends it to your prompt, and feeds the entire thing &lt;em&gt;back into itself&lt;/em&gt; to predict the token after that. It repeats this loop at lightning speed until it hits a designated "stop" token. This autocomplete loop is why you see the text stream onto your screen letter-by-letter.
## 6. Controlling the Output: Temperature
If the AI simply picked the #1 most probable token every single time, its responses would be completely rigid, repetitive, and robotic. To give the AI creativity and variance, developers use a setting called &lt;strong&gt;Temperature&lt;/strong&gt;.
Temperature controls how much risk the model takes when picking its next word.
| Low Temperature (e.g., 0.2) | High Temperature (e.g., 0.9) |
|---|---|
| &lt;strong&gt;Predictable &amp;amp; Focused:&lt;/strong&gt; The AI sticks strictly to the highest-probability words. | &lt;strong&gt;Creative &amp;amp; Random:&lt;/strong&gt; The AI is allowed to pick less probable, more "unexpected" words. |
| Ideal for: Writing code, debugging text, math, or factual summaries. | Ideal for: Brainstorming, writing fiction, naming a startup, or creative copy. |
## Wrapping Up: The Context Window
The final piece of the puzzle to keep in mind is the &lt;strong&gt;Context Window&lt;/strong&gt;. Because the model has to process your entire conversation history every time it generates a new token to remember what you said five minutes ago, there is a limit to how much data it can hold in its active memory at once.
Think of the context window as the AI's short-term working memory. If a model has a 128k token context window, it can remember roughly 90,000 words of conversation before it starts "forgetting" the oldest messages.
As a developer entering the GenAI space in 2026, understanding this pipeline—from prompt to token, transformer to probability calculation—is your superpower. You aren't just sending strings into a black box anymore; you are orchestrating a highly tuned, mathematical prediction engine.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>javascript</category>
      <category>llm</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>SnapShot 📸🔫</title>
      <dc:creator>Mohammad Mahabub Alam</dc:creator>
      <pubDate>Fri, 26 Jun 2026 16:11:28 +0000</pubDate>
      <link>https://dev.to/mahabubalam3004/snapshot-3jdh</link>
      <guid>https://dev.to/mahabubalam3004/snapshot-3jdh</guid>
      <description>&lt;p&gt;A snapshot is a frozen view of a database at a specific moment in time. It is like taking a digital photocopy of a document. Here document is the database and the photocopy is the snapshot. It is a read only static view of data means that you can look at the data but you can not change it within that snapshot itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The way it works:
&lt;/h2&gt;

&lt;p&gt;Generally we think that snapshot is a massive bulky copy of the entire database but that would be incredibly slow ans expensive. Instead modern databases use a clever trick called COW (Copy on write). So when you first take a snapshot, the database doesn't actually copy any data. It simply creates a pointer map, at the exact millisecond the snapshot and the live database are looking at the same physical block of the data on the disk. The magic happens only when someone tries to change the live data. &lt;br&gt;
For example: You have a row of data in block "A". If a user update that row the system identifies that block "A" is about to be changed. That time it copies that original old data to a specific snapshot storage area. after that it writes the newly data to the live database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember that the snapshot is taken only when the original data is going to update.&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;More explanation :&lt;/strong&gt;
The snapshot pointer and the live database pointer both points to the same block "A" memory location. After that when the user wants to update block "A"  with the new data, the system reads the original data from block "A" and writes it into the new physical space on the disk also can be refer as the snapshot storage. After that the snapshot pointer is updated to point the newly moved original data. The live database pointer stays where it is or moved to the newly created block to write the new data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The snapshot pointer is used to find the data that are already snapshot.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;If the system only update a pointer without copying the data than live update would overwrite the original data and your snapshot would be ruined. For that reason first it copies the old data, stores it into the snapshot storage and than the snapshot pointer update and points this memory storage.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Snapshot eventually slow down a database if they are kept for too long. Every time the data updates it copies the old one and than writes into the live data and update. It works double in this way. So to make it efficient modern databases used a method called ROW (Redirect on write).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Copy on Write (COW) : First copy the old data and than write the new one.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Redirect on write (ROW):&lt;/strong&gt; As in COw it moved the old data to save it but in ROW we leave the old data as it is and write the new data somewhere else. Same as before the snapshot and live database both point to block "A". When user is trying to update the data it keeps the old data as it is and write the new data into another new memory location. The snapshot pointer stays the same place but the live database pointer is redirected to the new block where the new data is stored.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Copy on Write&lt;/th&gt;
&lt;th&gt;Redirect on Write&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;It require 1 read 2 write (Read old→ write old elsewhere→ write new )&lt;/td&gt;
&lt;td&gt;It require only 1 write (new data stores in a new location.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Instant to create but slowdown overtime.&lt;/td&gt;
&lt;td&gt;Instant to create and stays fast during database updates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read the data faster than ROW&lt;/td&gt;
&lt;td&gt;Reading data is slow as new data took place in different locations.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>learning</category>
      <category>database</category>
    </item>
  </channel>
</rss>
