<?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>Forem: SingleStore</title>
    <description>The latest articles on Forem by SingleStore (@singlestore-developer).</description>
    <link>https://forem.com/singlestore-developer</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%2Forganization%2Fprofile_image%2F12110%2Fd3582d8f-2c09-48fa-83e9-e670097bc8c1.png</url>
      <title>Forem: SingleStore</title>
      <link>https://forem.com/singlestore-developer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/singlestore-developer"/>
    <language>en</language>
    <item>
      <title>Elasticsearch vs. SingleStore: What’s Best for Your Data Needs?</title>
      <dc:creator>Aasawari Sahasrabuddhe</dc:creator>
      <pubDate>Tue, 06 Jan 2026 11:01:55 +0000</pubDate>
      <link>https://forem.com/singlestore-developer/elasticsearch-vs-singlestore-whats-best-for-your-data-needs-1l62</link>
      <guid>https://forem.com/singlestore-developer/elasticsearch-vs-singlestore-whats-best-for-your-data-needs-1l62</guid>
      <description>&lt;p&gt;It's a data-driven world, and anyone who is building or using applications expects lightning-fast, context-aware search experiences. That’s why Model Content Protocols (MCPs) and hybrid search arose. Whether users are hunting for a specific keyword like “dog food quality” or something more abstract like “Turkish delight,” behind the scenes, modern search systems need to deliver both precision and semantic depth, offering results that are not only accurate but also contextually relevant.&lt;/p&gt;

&lt;p&gt;In creating search-based applications, developers have typically relied on Elasticsearch, built on Apache Lucene. And Elasticsearch performed well, at least until data sizes grew exceptionally large and until developers needed  more than just full-text or vector search.In scenarios where hybrid needs blending with keyword search, vector similarity, and structured filters, the limitations of Elasticsearch begin to show.&lt;/p&gt;

&lt;p&gt;In a comparison of &lt;a href="https://www.singlestore.com/elasticsearch/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=elastic&amp;amp;utm_content=singlestoresearch" rel="noopener noreferrer"&gt;Elasticsearch vs. SingleStore&lt;/a&gt;, we noted that the architecture of Elasticsearch isn't designed for advanced analytics, real-time hybrid queries, or unified operations across structured and unstructured data, leading to scalability challenges, increased operational overhead, and fragmented architectures. &lt;/p&gt;

&lt;p&gt;In this blog, we’ll examine different scenarios on how SingleStore’s hybrid search capability reduces the limitations encountered and faced in ElasticSearch. We'll walk through a hands-on experience using a set of Amazon product reviews, share real code examples, and examine core queries, full-text, vector, and hybrid searches. &lt;/p&gt;

&lt;h2&gt;
  
  
  The tale of two architectures
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The traditional search: Elasticsearch
&lt;/h3&gt;

&lt;p&gt;As we mentioned, Elastic is a proven search engine built on top of Apache Lucene. It uses inverted indexing structure for text and keyword matches. Apart from these features, Elastic is also great at: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: Each document stored as JSON; fields tokenized, analyzed. Flexible schema, but mapping complexity increases when introducing non-text fields.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: To get good performance, many parts of Lucene's inverted indices and vector indices must be in memory or warm disk-caches. However, large datasets push cost in RAM/disk IO.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Elasticsearch scales by horizontal sharding; replication ensures redundancy. But performance depends heavily on how shards, replicas, and node roles are configured.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;However, even with all these features and characteristics, Elastic still suffers from performance degradations at various levels. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Elasticsearch’s strongest game is keyword match and full text search, however, it starts to break down when you add SQL style joins, range filters and analytics. It often needs denormalized schemas or external pipelines.
&lt;/li&gt;
&lt;li&gt;Adding vector support in Elasticsearch means defining &lt;strong&gt;&lt;em&gt;dense_vector fields&lt;/em&gt;&lt;/strong&gt;, setting dimensions, similarity metric, indexing options, then ensuring documents are updated properly. This can create mapping mismatches that often lead to silent failures.
&lt;/li&gt;
&lt;li&gt;When data grows large, maintaining shards and replicas requires careful provisioning. And that means scaling to support heavy vector + filter + text workloads is nontrivial.
&lt;/li&gt;
&lt;li&gt;Elasticsearch often needs document refresh or index commit to make newly inserted/updated data visible for search. Embedding updates in particular tend to suffer from lag or non-visibility until refresh.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  SingleStore: The modern era of search
&lt;/h3&gt;

&lt;p&gt;So how can developers counter such issues? Enter SingleStore. SingleStore reimagines search for the age of real-time data and AI by unifying text search, vector search, and structured SQL in a single database engine. SingleStore offers a high-performance architecture that simplifies development and scales seamlessly. &lt;/p&gt;

&lt;p&gt;Here’s how SingleStore bridges the gaps left by traditional search engines:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;SingleStore’s rowstore and column store capability lets you handle both fast point lookups and large analytics without the need for a separate system.
&lt;/li&gt;
&lt;li&gt;The vectors come with built in similarity functions, hence there is no need for separate mappings, dimensions setting or hidden pitfalls.
&lt;/li&gt;
&lt;li&gt;SingleStore extends standard SQL with full-text search (&lt;code&gt;MATCH ... AGAINST&lt;/code&gt;) and vector functions. This allows you to run hybrid queries that combine text search, vector similarity, joins, filters, and aggregations in a single SQL statement – thus eliminating the need for separate pipelines or re-ranking steps.
&lt;/li&gt;
&lt;li&gt;With no need for multiple tools, your infrastructure footprint is reduced. The results are faster, efficient and lower cost of ownership.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In summary, if you want real-time search that handles both vector and text,  plus filters, joins, and analytics,  SingleStore delivers what Elastic often can only approximate. In experiments to test vector + filters + embedding visibility, every time Elasticsearch failed (or required fiddling)  SingleStore handled it cleanly. That makes a big difference in developer time, reliability, and latency, especially when building production systems.&lt;/p&gt;

&lt;p&gt;In the following sections, we’ll examine these concepts with a real-world data set and understand how the two search capabilities differ. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;In the example use case below, certain prerequisites will help you follow along: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Amazon Product Reviews dataset from &lt;a href="https://www.kaggle.com/datasets/arhamrumi/amazon-product-reviews" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt;. For this blog, we have used a smaller structure of the complete dataset for faster embeddings.
&lt;/li&gt;
&lt;li&gt;A SingleStore Helios account. You can create a free new workspace on Helios using the &lt;a href="https://portal.singlestore.com/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=elastic&amp;amp;utm_content=singlestoresearch" rel="noopener noreferrer"&gt;Helios signup page&lt;/a&gt;. Once set, you can load the dataset directly and then connect your &lt;a href="https://www.singlestore.com/blog/using-python-jupyter-notebook-with-singlestoredb/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=elastic&amp;amp;utm_content=singlestoresearch" rel="noopener noreferrer"&gt;Python application from Jupiter notebook&lt;/a&gt; directly on Helios. A &lt;strong&gt;single&lt;/strong&gt; place for all your &lt;strong&gt;storage&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Once set up, you’ll have a table structure similar to this schema: &lt;/li&gt;
&lt;/ol&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.amazonaws.com%2Fuploads%2Farticles%2Fzlxv30ttr5jt028g6hp8.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.amazonaws.com%2Fuploads%2Farticles%2Fzlxv30ttr5jt028g6hp8.png" alt="Table structure" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you’re ready to test the use case. &lt;/p&gt;

&lt;h2&gt;
  
  
  Search implementation
&lt;/h2&gt;

&lt;p&gt;To test the complete use case, we’ll perform three different kinds of search operations around approximately 10K of data. For this blog, we have tested, full-text search, vector search and hybrid search. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full-text search&lt;/strong&gt; is a classic keyword or phrase search. This matches words in the query to words in documents using inverted indexes and BM25 scoring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vector search&lt;/strong&gt; is a semantic search powered by embeddings. Instead of exact keywords, it finds reviews with &lt;em&gt;similar meaning&lt;/em&gt; to the query.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hybrid search&lt;/strong&gt; combines both approaches, blending keyword precision with semantic recall.&lt;/p&gt;

&lt;h3&gt;
  
  
  SingleStore implementation
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Full-Text search:&lt;/em&gt;&lt;/strong&gt; finds reviews with exact or close word matches using MATCH … AGAINST.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#%%
# ==========================================================
# 3. Full-Text Search
# ==========================================================
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_text_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topk&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        SELECT Id, Summary, MATCH(Text) AGAINST (%s) AS score
        FROM amazon_reviews
        WHERE MATCH(Text) AGAINST (%s)
        ORDER BY score DESC
        LIMIT %s
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topk&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;🔎 Full-text search in &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; sec&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;

&lt;span class="c1"&gt;# Example queries
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;full_text_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dog food&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;full_text_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cough medicine&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Vector search&lt;/strong&gt; finds semantically similar reviews by computing dot product similarity between embeddings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ==========================================================
# 4. Vector Search
# ==========================================================
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;vector_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topk&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;qvec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;embed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;vec_json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qvec&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"'"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'"'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# JSON array string
&lt;/span&gt;    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        SELECT Id, Summary,
               DOT_PRODUCT(embedding, %s) AS score
        FROM amazon_reviews
        WHERE embedding IS NOT NULL
        ORDER BY score DESC
        LIMIT %s
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vec_json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topk&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;🔎 Vector search in &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; sec&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;

&lt;span class="c1"&gt;# Example queries
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;vector_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;healthy pet food&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;vector_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;candy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Hybrid search&lt;/strong&gt; blends text and vector scores in SQL, giving full control over weighting&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hybrid_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topk&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text_weight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vector_weight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;qvec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;embed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;vec_json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qvec&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"'"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'"'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        SELECT Id, Summary,
               COALESCE(MATCH(Text) AGAINST (%s), 0) AS text_score,
               COALESCE(DOT_PRODUCT(embedding, %s), 0) AS vector_score,
               (%s * COALESCE(MATCH(Text) AGAINST (%s), 0) +
                %s * COALESCE(DOT_PRODUCT(embedding, %s), 0)) AS hybrid_score
        FROM amazon_reviews
        WHERE embedding IS NOT NULL
        ORDER BY hybrid_score DESC
        LIMIT %s
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vec_json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text_weight&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vector_weight&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vec_json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topk&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;⚡ Hybrid search (fast) in &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; sec&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;

&lt;span class="c1"&gt;# Example
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;hybrid_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dog food&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once these implementations are done, we can explore how performing search with similar keywords on SingleStore performs with better accuracy and efficiency. &lt;/p&gt;

&lt;h2&gt;
  
  
  Results and observations
&lt;/h2&gt;

&lt;p&gt;After running the above code with the same dataset and search queries, we observed consistent and significant improvements in the results with SingleStore. The table below outlines the performance across multiple runs on the same dataset.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;th&gt;Execution time&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Full-text search&lt;/td&gt;
&lt;td&gt;More precise results, simpler query.&lt;/td&gt;
&lt;td&gt;Execution time in test: &lt;strong&gt;0.38s.&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vector search&lt;/td&gt;
&lt;td&gt;Native vector column and built-in similarity.&lt;/td&gt;
&lt;td&gt;Execution time in test: &lt;strong&gt;0.37s&lt;/strong&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hybrid search&lt;/td&gt;
&lt;td&gt;Clear, tunable, supports normalization.&lt;/td&gt;
&lt;td&gt;Execution time in test: &lt;strong&gt;0.35s&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Observations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Unlike engines that may vary the results depending on refresh cycles or index updates, SingleStore returned consistent rankings across repeated queries.
&lt;/li&gt;
&lt;li&gt;Even when we scaled the dataset from ~10K to ~100K records, execution times remained under a second, showing linear scaling without complex tuning.
&lt;/li&gt;
&lt;li&gt;All three search types were expressed in straightforward SQL. No custom DSL, schema tweaks, or refresh calls were required.
&lt;/li&gt;
&lt;li&gt;By adjusting weights in SQL (e.g., 0.7*vector_score + 0.3*text_score), we can tune the balance between semantic and keyword relevance with full transparency.
&lt;/li&gt;
&lt;li&gt;Newly inserted rows were immediately searchable in both full-text and vector queries without needing manual refreshes or re-indexing.
&lt;/li&gt;
&lt;li&gt;Because text, vector, and hybrid search all run inside the same engine, there’s no need for multiple pipelines or extra services, reducing infra overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These results demonstrate  that while Elasticsearch is still a strong keyword search engine, SingleStore delivers a unified, real-time, and lower-latency platform for modern hybrid search. &lt;/p&gt;

&lt;h2&gt;
  
  
  A real-world example: Why SingleStore wins
&lt;/h2&gt;

&lt;p&gt;A customer faced rapid growth where thousands of publications and customers started to add hundreds of titles. Their existing stack, with plans to add Elastic, wasn’t working well. They started to face issues like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Poor search performance.
&lt;/li&gt;
&lt;li&gt;Infrastructure limitations
&lt;/li&gt;
&lt;li&gt;Scaling and unpredictable cost limits.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why SingleStore was a better choice
&lt;/h3&gt;

&lt;p&gt;With SingleStore, the above issues were easily addressed, because ingleStore unifies transactional and analytic workloads and supports search use cases without adding separate systems.&lt;br&gt;&lt;br&gt;
With SingleStore, the customer&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Experienced dramatic gains in speed and accuracy (up to 70x)
&lt;/li&gt;
&lt;li&gt;Was able to process millions of rows and sustain ~120K queries per minute for real-time workloads
&lt;/li&gt;
&lt;li&gt;Enjoyed up to 35% acceleration in analytics/dashboard performance
&lt;/li&gt;
&lt;li&gt;Lowered their cost and operational overhead. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The customer summed it up as follows: “SingleStore will seriously decrease our infrastructure complexity, allowing us to move faster and with more confidence. This all started with search, but now it's far bigger than that.” &lt;/p&gt;

&lt;p&gt;This real-world story matches what we observed in our 10K experiment: SingleStore provided faster, more consistent full-text, vector and hybrid queries, and a simpler developer experience.&lt;br&gt;&lt;br&gt;
Where Elasticsearch required DSL gymnastics, mappings, refresh calls and script scoring, SingleStore enabled the customer to  express hybrid search and normalization directly in one SQL query and get immediate, reproducible results.&lt;/p&gt;

&lt;p&gt;When searching in your application is only one piece of a broader real-time data problem, SingleStore is a great solution.&lt;/p&gt;

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

&lt;p&gt;By bringing vectors, full-text and SQL all together in one engine, SingleStore. makes hybrid queries simple, fast, and consistent. This helps in lowering engineering overheads and makes product behavior predictable. &lt;/p&gt;

&lt;p&gt;If you’re looking for search that’s semantic, precise, and real-time and you’d rather express that logic in SQL than stitch together multiple services, SingleStore is worth a short proof-of-concept. &lt;/p&gt;

&lt;p&gt;To learn more about SingleStore, visit our &lt;a href="https://docs.singlestore.com/db/v8.9/introduction/singlestore-documentation/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=elastic&amp;amp;utm_content=singlestoresearch" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;. You can also register for a &lt;a href="https://www.singlestore.com/events/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=elastic&amp;amp;utm_content=singlestoresearch" rel="noopener noreferrer"&gt;SingleStore webinar&lt;/a&gt; and learn about the latest concepts and technologies through hands-on experience. &lt;/p&gt;

</description>
      <category>elasticsearch</category>
      <category>singlestore</category>
      <category>data</category>
      <category>ai</category>
    </item>
    <item>
      <title>Choosing Rowstore or Columnstore? How to Pick the Right Engine for Your Workload</title>
      <dc:creator>Aasawari Sahasrabuddhe</dc:creator>
      <pubDate>Mon, 29 Dec 2025 06:30:00 +0000</pubDate>
      <link>https://forem.com/singlestore-developer/choosing-rowstore-or-columnstore-how-to-pick-the-right-engine-for-your-workload-b4d</link>
      <guid>https://forem.com/singlestore-developer/choosing-rowstore-or-columnstore-how-to-pick-the-right-engine-for-your-workload-b4d</guid>
      <description>&lt;p&gt;Modern day workloads must balance the conflicting demands of the application. The applications are required to have milliseconds of latency in transactional operations, efficient analytical workloads across massive data, and the data flexibility demanded by AI/ML workloads. Traditional architectures force a binary choice between rowstore and columnstore storage formats, each optimized for fundamentally different access patterns. &lt;/p&gt;

&lt;p&gt;This guide explores the architectural characteristics of each engine, provides decision criteria for selecting the right format for the workload, and demonstrates how unified storage architectures. This blog further demonstrates how SingleStore Helios examine transactional workloads, analytical scenarios, and the emerging requirements of AI-driven applications. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is RowStore Storage?
&lt;/h2&gt;

&lt;p&gt;A rowstore in storage refers to a storage format that stores data in rows with all the fields of a row stored together in the same physical location. These are in-memory storages which store data inside RAM rather than disk. This means that each row contains all columns for a single record, stored contiguously in memory or disk.This avoids disk I/O and significantly speeds up data access and manipulation. &lt;/p&gt;

&lt;h2&gt;
  
  
  How does a rowstore work?
&lt;/h2&gt;

&lt;p&gt;A rowstore stores the data onto the memory by rows, which means, when you insert a record with 50 columns, all 50 columns are written together to the same memory location. Subsequent queries that need multiple columns from a single row retrieve them efficiently because they're co-located. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where are the Rowstores efficient?
&lt;/h2&gt;

&lt;p&gt;The key advantages that makes the rowstore efficient are: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ultra-low latency queries: Row-based storage retrieves an entire record in a single memory access, enabling extremely fast lookups. Indexed queries typically return within 100–500 microseconds.
&lt;/li&gt;
&lt;li&gt;High-throughput writes: rowstore supports lock-free concurrency, allowing 500K+ inserts per second per node without blocking read operations.
&lt;/li&gt;
&lt;li&gt;Strong transactional consistency: ACID guarantees are built into the rowstore architecture. Multi-statement transactions maintain consistency across related updates without requiring complex coordination.
&lt;/li&gt;
&lt;li&gt;Optimized for full-row access: Queries that need most or all columns execute with minimal data movement. For example, selecting 40 out of 50 columns touches almost the same memory footprint as selecting all 50.
&lt;/li&gt;
&lt;li&gt;Highly effective indexing: B-tree and hash indexes on primary and foreign keys deliver predictable, sub-millisecond lookup performance, even at large scale.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where are rowstore storages proved to be efficient?
&lt;/h2&gt;

&lt;p&gt;Rowstore excels in workloads where speed, transactional integrity, and frequent point lookups are critical. It is particularly efficient in:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Transactional heavy workloads like applications such as banking, payments, e-commerce and user profiles that depend on rapid inserts, updates and precise data retrieval.
&lt;/li&gt;
&lt;li&gt;Use cases that require instant decisioning like fraud detection, personalization engines, session management benefit from rowstore’s ability to fetch full records with minimal overhead.
&lt;/li&gt;
&lt;li&gt;Operational tables with wide schemas where customer profiles, product catalogs, configurations perform exceptionally well because rowstore minimizes memory movement when returning full rows.
&lt;/li&gt;
&lt;li&gt;Writing heavy applications like IoT ingestion, event logging, telemetry, or status tracking pipelines helps inserting at rapid speed. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to create RowStore tables in SingleStore
&lt;/h2&gt;

&lt;p&gt;Starting with SingleStore version 7.3, rowstore has &lt;strong&gt;not&lt;/strong&gt; been the default table storage format. To create a rowstore table explicitly in SingleStore helios,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;row&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;product_details&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="n"&gt;ProductId&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;Color&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="n"&gt;Price&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;dt&lt;/span&gt; &lt;span class="nb"&gt;DATETIME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Price&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="n"&gt;SHARD&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ProductId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above command, the shard key controls how the data is distributed in memory. The &lt;em&gt;KEY&lt;/em&gt; specified on Price causes an index to be created on the Price column.&lt;/p&gt;

&lt;p&gt;It is also possible to randomly distribute data by either omitting the shard key, or defining an empty shard key SHARD KEY(), as long as no primary key is defined. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;ROWSTORE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="n"&gt;ProductId&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;Color&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="n"&gt;Price&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;dt&lt;/span&gt; &lt;span class="nb"&gt;DATETIME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Price&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="n"&gt;SHARD&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Drawbacks of RowStore
&lt;/h2&gt;

&lt;p&gt;While row store works best for transactional and write heavy workloads, it is perhaps not the first choice of storage for analytics heavy or scan heavy applications. It becomes less efficient in scenarios like: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Large scale analytical workloads: For queries that require scanning millions or billions of rows such as aggregations, trends, reporting, and dashboards perform significantly slower on rowstore.
&lt;/li&gt;
&lt;li&gt;Compressed data storage: row store stores data row-by-row, which limits compression opportunities. For workloads where storage footprint matters, columnstore is more efficient due to better compression ratios.
&lt;/li&gt;
&lt;li&gt;Complex analytics: For queries that involve large joins, group-bys, window functions, and CPU-heavy analytical operations, columnstore’s vectorized engine provides superior performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is ColumnStore Storage?
&lt;/h2&gt;

&lt;p&gt;While we have seen where rowstores do not perform the best, column stores are certainly the best choice for such workloads. A columnstore organises data by columns. All values for a single column are stored together, separate from other columns.&lt;/p&gt;

&lt;p&gt;Also known as the universal storage, SingleStore makes columnsstore the default table type in SingleStore Helios.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does ColumnStore work ?
&lt;/h2&gt;

&lt;p&gt;Briefly, when you insert records with 50 columns, the columnstore stores all values of column_1 together, all values of column_2 together, and so on. Column values are compressed and indexed separately. &lt;/p&gt;

&lt;p&gt;The SingleStore Helios columnstore is an optimized storage format designed for fast analytics, efficient compression, and scalable performance. It organizes data by columns rather than rows, but includes several structures that improve both analytical and transactional workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Clustered Columnstore Index: The Core Storage Engine
&lt;/h3&gt;

&lt;p&gt;In SingleStore Helios, a table stored as a clustered columnstore index becomes the primary storage representation of the table. Unlike traditional databases that separate data storage from indexing, SingleStore makes the columnstore index the table itself.&lt;br&gt;&lt;br&gt;
This design minimizes overhead and ensures that analytics workloads operate directly on compressed, column-oriented data.&lt;/p&gt;
&lt;h3&gt;
  
  
  Sort Keys: The Most Important Optimization Choice
&lt;/h3&gt;

&lt;p&gt;When you define a columnstore index, you choose one or more sort key columns. These columns determine the physical sorting of data inside the columnstore.&lt;br&gt;&lt;br&gt;
Choosing the right sort key is critical because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It maximizes segment elimination, allowing the engine to skip irrelevant data ranges.
&lt;/li&gt;
&lt;li&gt;It improves range queries, JOIN performance, and filter pushdown.
&lt;/li&gt;
&lt;li&gt;It reduces CPU work during large analytical scans.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, users often sort by columns such as timestamp, price, or user_id, depending on the dominant access patterns.&lt;/p&gt;
&lt;h3&gt;
  
  
  Row Segments: Large Blocks of Logically Grouped Rows
&lt;/h3&gt;

&lt;p&gt;A columnstore table is internally divided into row segments, each typically containing hundreds of thousands of rows. Each row segment includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The row count
&lt;/li&gt;
&lt;li&gt;A deleted-row bitmask for transactional updates
&lt;/li&gt;
&lt;li&gt;A set of column segments, one per column&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This segmentation is fundamental for parallel execution and distributed query performance.&lt;/p&gt;
&lt;h3&gt;
  
  
  Column Segments: The True Unit of Storage
&lt;/h3&gt;

&lt;p&gt;Each row segment contains a column segment for every column in the table.&lt;br&gt;&lt;br&gt;
A column segment stores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All values for that column within the segment
&lt;/li&gt;
&lt;li&gt;Metadata such as minimum and maximum values
&lt;/li&gt;
&lt;li&gt;Compression-optimized encoding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The min/max metadata enables segment elimination, one of the biggest performance levers. During a query, if a filter cannot possibly match a segment's value range, the system skips that entire block.&lt;/p&gt;

&lt;p&gt;This is why SingleStore can scan billions of rows extremely fast and avoids scanning most of them.&lt;/p&gt;
&lt;h3&gt;
  
  
  Column Groups: Faster Lookups Without RowStore Overhead
&lt;/h3&gt;

&lt;p&gt;SingleStore also supports column groups, an optional structure that materializes full rows in a compact, index-like layout.&lt;br&gt;&lt;br&gt;
 Column groups improve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Point lookups
&lt;/li&gt;
&lt;li&gt;Full-row access patterns
&lt;/li&gt;
&lt;li&gt;Update throughput&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because column groups consume far less memory than row store tables, they provide row-like access performance while keeping the table in columnar form.&lt;br&gt;&lt;br&gt;
This eliminates the need to manage duplicated row store/columnstore architectures.&lt;/p&gt;
&lt;h3&gt;
  
  
  Sorted Row Segment Groups: Maintaining Ordered Ranges
&lt;/h3&gt;

&lt;p&gt;Row segments are grouped into sorted row segment groups, where each group contains non-overlapping ranges of the sort key. More segment groups means more comparison work at query time. These groups grow over time as INSERT, LOAD, and UPDATE operations add new segments.&lt;/p&gt;

&lt;p&gt;Managing segment group count is a key part of maintaining long-term performance, and SingleStore provides tools like OPTIMIZE TABLE to merge and rebalance these segments. &lt;/p&gt;
&lt;h2&gt;
  
  
  Where does ColumnStore work best?
&lt;/h2&gt;

&lt;p&gt;While we have seen how a rowstore storage system fails in certain scenarios, columnStore storage type is the one that outshines in those use cases. Some of the use cases where ColumnStore is considered as the first choice are: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ColumnStore stores identical or similar values together and enables compression algorithms to achieve 10:1 to 100:1 reduction, thus giving a high compression ratio, lower storage and faster scans.
&lt;/li&gt;
&lt;li&gt;ColumnStore storage types are best for high analytical workloads. They reduce I/O dramatically and enable sub-second scans on billions of rows.
&lt;/li&gt;
&lt;li&gt;Column-native formats allow CPUs to process many values in a single instruction. This leads to higher throughput, better performance and AI driven analytics.
&lt;/li&gt;
&lt;li&gt;Aggregation operations used in analytics become simpler and significantly faster as the engine operates on compressed blocks, storage ranges and single columns vectors.
&lt;/li&gt;
&lt;li&gt;They avoid row level locks thus larger scans do not block the lightweight OLTP operations.
&lt;/li&gt;
&lt;li&gt;Columnstores distribute column segments efficiently across nodes, enabling applications to scale seamlessly while supporting high ingestion throughput and parallel execution. This helps the cloud native applications reply on SingleStore. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A columnstore delivers lightning-fast analytics, high compression, efficient scans, and scalable performance by storing data column-by-column instead of row-by-row making it the preferred architecture for real-time analytics, AI workloads, and modern data-intensive applications.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to create a ColumnStore table in SingleStore ?
&lt;/h2&gt;

&lt;p&gt;The default table type in SingleStore is columnstore. The default can be changed to row store by updating the default_table_type engine variable to rowstore. To create a columnstore table in Helios,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="n"&gt;ProductId&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;Color&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="n"&gt;Price&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;Qty&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;SORT&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Price&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="n"&gt;SHARD&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ProductId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The SHARD KEY controls the data distribution. In the above case, the productId is the SHARD KEY since sharding on a high cardinality identifier column generally allows for a more even distribution and prevents skew.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases when columnstore does not perform well
&lt;/h2&gt;

&lt;p&gt;As said in row store cases, there are use cases and scenarios when columnstore tend to perform poorly. Some of these are: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Application involving heavy writes, updates and detest. Using column stores in these cases could tend to be expensive and utilize more memory.
&lt;/li&gt;
&lt;li&gt;For transactional systems that need to retrieve entire rows frequently or perform many small, random lookups, columnstore is inefficient.
&lt;/li&gt;
&lt;li&gt;Columnstore tends to perform poorly with smaller tables.
&lt;/li&gt;
&lt;li&gt;Updating or deleting specific rows is particularly inefficient since the database must locate data scattered across multiple column segments rather than accessing a single row location.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Difference between RowStore and ColumnStore
&lt;/h2&gt;

&lt;p&gt;Selecting the right storage engine depends entirely on workload access patterns. Row store is purpose-built for transactional workloads that demand microsecond latency, rapid inserts, and full-row access. Columnstore, on the other hand, is optimized for analytical workloads where compression, fast scans, and parallel execution matter most. The table below outlines the fundamental differences to help you choose the right engine for each use case.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimensions&lt;/th&gt;
&lt;th&gt;Rowstore&lt;/th&gt;
&lt;th&gt;Columnstore&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;How data is stored&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Data stored column-by-column; values of each column grouped and compressed&lt;/td&gt;
&lt;td&gt;Data stored column-by-column; values of each column grouped and compressed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary Strength&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ultra-low latency lookups, fast writes, strong transactional consistency&lt;/td&gt;
&lt;td&gt;High compression, fast analytics, scalable parallel scans&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Latency Characteristics&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Microsecond-level lookups&lt;/td&gt;
&lt;td&gt;Sub-second scans on billions of rows due to segment elimination&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Write Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Extremely high ingestion (500K+ inserts/sec/node), lock-free concurrency&lt;/td&gt;
&lt;td&gt;High ingestion but optimized more for read-heavy analytics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Query Pattern efficiency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Best for queries retrieving many columns from a single row&lt;/td&gt;
&lt;td&gt;Best for queries retrieving few columns across many rows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vertical scaling; memory-bound due to in-RAM structure&lt;/td&gt;
&lt;td&gt;Horizontal scaling; segments distributed across nodes for parallel execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Concurrency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ideal for mixed read/write workloads with row-level operations&lt;/td&gt;
&lt;td&gt;Avoids row-level locks; large scans run without blocking OLTP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Analytical Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slower for large scans, joins, group-bys, window functions&lt;/td&gt;
&lt;td&gt;Optimized for vectorized execution and analytical operations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Storage footprint&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Larger footprint due to limited compression&lt;/td&gt;
&lt;td&gt;Much smaller due to columnar compression algorithms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use cases&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Banking, payments, personalization, fraud detection, IoT ingestion, operational tables&lt;/td&gt;
&lt;td&gt;Real-time analytics, log processing, BI dashboards, feature stores, AI workloads&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Choosing the right datastore for AI workloads
&lt;/h2&gt;

&lt;p&gt;In general, row stores excel at OLTP-like AI workloads: real-time inference, streaming feature updates and low-latency lookups of individual records. They can handle high inserts, give uniform milliseconds response for single key queries. Whereas Columnstores excel at OLAP-like workloads: scanning large feature tables, batch training data preparation, analytics dashboards and vector similarity search. They offer much higher compression, throughput and scalability when queries touch many rows or only a few columns of wide tables.&lt;/p&gt;

&lt;p&gt;A common pattern is to use both: keep hot, indexed data in a row-oriented store for speed, and archive or analyze large datasets in a columnar store for efficiency. Modern hybrid systems (e.g. SingleStore Helios) try to unify these, automatically routing transactions into a row buffer and compressing cold data column-wise, or letting you define materialized column groups to cover full-row queries. Ultimately, the right choice depends on your AI workload’s access pattern: if it’s mostly random key/value lookups and updates, lean rowstore; if it’s heavy scans, aggregations, or vector math over millions of rows, lean columnstore.&lt;/p&gt;

&lt;p&gt;By matching the storage engine to the workload’s profile, point lookups vs. wide scans, update-heavy vs. read-heavy, data architects can optimize latency, cost, and scalability for AI applications. Let us understand this with a few AI workloads example: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Real-Time Inference&lt;/strong&gt;: Applications like fraud detection, building recommendation systems, personalisation engines etc, demand a low latency lookups. These workloads are typically point queries like “get user profile features for this transaction”, which favors row-oriented storage. A &lt;strong&gt;row store&lt;/strong&gt; would excel at random reads and writes, fetching an entire record with minimal latency.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature Engineerings&lt;/strong&gt;: Feature engineering and feature-store workloads span both large-scale analytics and low-latency lookups. Offline feature computation (joining logs, aggregating historical data) is a classic OLAP task, whereas serving features to live models is OLTP. In this case, columnstore would provide a very high throughput on analytics queries , with tolerable latency. For online feature lookup, a row store is still used to serve low-latency point queries.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training on large datasets:&lt;/strong&gt; For model training workloads that involve reading large volumes of feature data, a columnstore is recommended. It efficiently reads only the required columns and leverages compression to optimize storage and scan performance.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vector Search / Embedding Retrieval&lt;/strong&gt;: Specialized vector store or columnstore with ANN index. Similarity search operates on high-dimensional embedding vectors. Columnar formats can help by storing the entire vector contiguously as a column, so queries read only the embedding column. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;However, it is important to note that these recommendations are not one-size-fits-all solutions. Choosing the right storage engine ultimately depends on your specific workload characteristics, performance goals, infrastructure constraints, and cost considerations. Readers are encouraged to evaluate based on real-world access patterns, data volume, latency requirements, and operational complexity.&lt;/p&gt;

&lt;p&gt;Start building applications with SingleStore Helios today!!&lt;/p&gt;

&lt;h2&gt;
  
  
  Ready to Build Your Own?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.singlestore.com/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=ai&amp;amp;utm_content=fintech-with-singlestore" rel="noopener noreferrer"&gt;Try SingleStore Helios&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.singlestore.com/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=ai&amp;amp;utm_content=fintech-with-singlestore" rel="noopener noreferrer"&gt;Read Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.singlestore.com/demo/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=ai&amp;amp;utm_content=fintech-with-singlestore" rel="noopener noreferrer"&gt;Watch Demo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://bit.ly/singlestorewebinars/?utm_source=Aasawari&amp;amp;utm_medium=blog&amp;amp;utm_campaign=ai&amp;amp;utm_content=fintech-with-singlestore" rel="noopener noreferrer"&gt;Upcoming Webinars&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>database</category>
      <category>vectordatabase</category>
      <category>ai</category>
      <category>singlestore</category>
    </item>
    <item>
      <title>What is Context Engineering!</title>
      <dc:creator>Pavan Belagatti</dc:creator>
      <pubDate>Thu, 16 Oct 2025 09:27:27 +0000</pubDate>
      <link>https://forem.com/singlestore-developer/what-is-context-engineering-10kk</link>
      <guid>https://forem.com/singlestore-developer/what-is-context-engineering-10kk</guid>
      <description>&lt;p&gt;AI systems have evolved so much that anyone can build highly agentic autonomous systems with no-code or low-code platforms/tools. We have come a long way from LLM chatbots to RAG systems to AI agents, but still there is one challenge that persists: context. LLMs are only as good as the information they have at the moment of reasoning. Without the right data, tools and signals, they hallucinate, make poor decisions or simply fail to execute reliably. Your AI systems should be equipped with proper context so that they are highly efficient and deliver value. This is where Context Engineering emerges as a discipline to optimally provide the right context at the right time to your AI systems.&lt;/p&gt;

&lt;p&gt;In this article, we’ll dig deeper into the world of context engineering and understand everything about it. Let’s get started. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is context engineering?
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fj5m9jpw36cqqnvlo8n2g.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.amazonaws.com%2Fuploads%2Farticles%2Fj5m9jpw36cqqnvlo8n2g.png" alt="context engineering" width="800" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unlike prompt engineering, which focuses mainly on crafting clever instructions for LLMs, context engineering is the systematic discipline of designing and optimizing the surrounding environment in which AI systems operate. It goes beyond prompts to carefully structure the data, tools, information and workflows that maintain the overall context for an AI system. By doing so, context engineering ensures that tasks are executed not just creatively, but reliably, consistently and intelligently.&lt;/p&gt;

&lt;p&gt;At its core, context engineering acknowledges that an LLM by itself knows nothing relevant about a task. Its effectiveness depends on the quality and completeness of the context it receives. This involves curating the right knowledge sources, integrating external systems, maintaining memory across interactions, and aligning tools so the AI agent always has access to what it needs, when it needs it. Small gaps in context can lead to drastically different outcomes — errors, contradictions or hallucinations.&lt;/p&gt;

&lt;p&gt;That’s why context engineering is emerging as one of the most critical practices in building robust AI applications. It’s not just about telling the model what to do; it’s about setting up the stage, the rules and the resources so the AI can make better decisions, reason effectively and adapt to real-world complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt engineering vs. context engineering
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fhj7uuqjb4202v8dv69zx.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.amazonaws.com%2Fuploads%2Farticles%2Fhj7uuqjb4202v8dv69zx.png" alt="Prompt engineering vs. context engineering" width="800" height="666"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Context engineering is fundamentally superior to prompt engineering because it addresses the core limitation of AI systems: they only know what you give them.Prompt engineering is like giving someone instructions without any background information, tools or reference materials. You're constantly trying to cram everything into a single question, hoping the AI remembers enough to answer correctly. It's unreliable — the same prompt can produce different results, and there's no way to maintain consistency across interactions or access real-time data.&lt;/p&gt;

&lt;p&gt;Context engineering treats the AI as part of a complete system. Instead of relying on clever wording, you architect the entire environment: you integrate knowledge databases so the AI accesses accurate information, connect external tools and APIs so it can perform real actions, implement memory systems so it remembers previous interactions, and establish workflows that ensure consistent, predictable behavior.&lt;/p&gt;

&lt;p&gt;The difference is profound. Prompt engineering is about asking better questions. Context engineering is about building better systems. One produces occasionally impressive outputs; the other creates reliable, production-ready applications.&lt;/p&gt;

&lt;p&gt;Small gaps in context lead to hallucinations, errors and failures. Context engineering eliminates these gaps systematically, ensuring the AI always has what it needs to make intelligent decisions and deliver consistent results in real-world applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  RAG vs. context engineering
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fhx9094qc5vfzw8jj5xsl.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.amazonaws.com%2Fuploads%2Farticles%2Fhx9094qc5vfzw8jj5xsl.png" alt="RAG vs. context engineering" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The RAG pipeline starts with a query from the user. That query is transformed into an embedding, a vector representation that captures semantic meaning. The system then performs a vector search across a knowledge base to find the most relevant pieces of information. Using Top-K retrieval, it selects a handful of the most similar results. These are then “stuffed into context” and fed into the LLM (Large Language Model). While this approach enriches the model with external knowledge, it is often rigid — relying heavily on similarity search and lacking adaptability in how context is used.&lt;/p&gt;

&lt;p&gt;On the right, context engineering builds on this idea but adds sophistication. After the query, it introduces a context router that decides how best to process and route the information. This router supports three key processes: selection (choosing the most relevant pieces), organization (structuring information logically), and evolution (adapting and improving context dynamically). These steps produce an optimized context, which is then passed to the LLM.&lt;/p&gt;

&lt;p&gt;The difference is clear: RAG fetches and dumps context, while context engineering curates, structures and evolves it, leading to more accurate, reliable and contextually aligned outputs.   &lt;/p&gt;

&lt;h2&gt;
  
  
  The Role of MCP in Context Engineering
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fw3if29cjegl9uslypwgt.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.amazonaws.com%2Fuploads%2Farticles%2Fw3if29cjegl9uslypwgt.png" alt="MCP in Context Engineering" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://modelcontextprotocol.io/docs/getting-started/intro" rel="noopener noreferrer"&gt;Model context protocol (MCP)&lt;/a&gt; has been the talk of the town for AI applications as a universal USB to plug &amp;amp; play with any tools &amp;amp; data sources. Instead of working with every API, MCP helps you manage everything in one place. The MCP serves as a critical foundation in context engineering, acting as a standardized intermediary between diverse data sources and AI models to deliver structured, actionable context for intelligent applications. &lt;/p&gt;

&lt;p&gt;MCP eliminates the complexity of bespoke integrations by providing a universal interface for databases (such as SQL, NoSQL, and vector stores), APIs, file systems, and external analytics tools. Through its four essential capabilities—standardized interface, context aggregation, dynamic retrieval, and security—MCP seamlessly collects, normalizes, and governs real-time data flow from multiple systems.&lt;/p&gt;

&lt;p&gt;Within context engineering, MCP enables dynamic context elicitation: it fetches, assembles, and secures relevant information tailored to the AI model’s current intent or task, vastly improving response relevance and grounding output in real, up-to-date enterprise knowledge. Developers utilize MCP servers to expose organization-specific data and permissions, while AI agents (such as LLMs) connect through MCP clients to intake context in machine-understandable formats, respond to user queries, and adapt outputs based on the latest data.&lt;/p&gt;

&lt;p&gt;SingleStore exemplifies the practical power of MCP in AI workflows. Its &lt;a href="https://github.com/singlestore-labs/mcp-server-singlestore" rel="noopener noreferrer"&gt;MCP server&lt;/a&gt; bridges LLMs and SingleStore’s high-performance databases, enabling natural language queries, workspace management, SQL execution, and even schema visualization—directly via AI assistants like Claude or development tools. The &lt;a href="https://www.singlestore.com/blog/presenting-singlestore-mcp-server/" rel="noopener noreferrer"&gt;SingleStore MCP server&lt;/a&gt; authenticates with enterprise databases, manages user-specific sessions, enforces access control, and provides seamless, context-rich interactions for both operational and analytical tasks—making it a flagship implementation of context engineering in modern enterprise AI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building context-aware workflows with SingleStore
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2F0hqjn0juhncoatoikfu2.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.amazonaws.com%2Fuploads%2Farticles%2F0hqjn0juhncoatoikfu2.png" alt="Building context-aware workflows" width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram illustrates a simplified context engineering workflow built around SingleStore as the long-term memory layer. It begins with the user input, which serves as the query or problem statement. The system then performs retrieval and assembly, where relevant context is fetched from SingleStore using vector search and combined with short-term memory such as recent chat history to build a complete, context-rich prompt. This enhanced prompt is then passed to the LLM or AI agent, which processes it, performs reasoning and optionally executes external tool calls to generate a coherent, informed response. &lt;/p&gt;

&lt;p&gt;The final stage is write-back memory, where the generated answer, conversation insights and any new knowledge are stored back into SingleStore. This ensures that every new interaction strengthens the system’s contextual understanding over time. The result is a self-improving, context-aware workflow — the essence of context engineering in action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context-aware tutorial with SingleStore
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://portal.singlestore.com/intention/cloud?utm_medium=referral&amp;amp;utm_source=pavan&amp;amp;utm_term=context&amp;amp;utm_content=ssblog" rel="noopener noreferrer"&gt;Sign up to SingleStore for free&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go to SingleStore, create a workspace and a database to hold the context.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2Fj64f4v9ci2a7ky2276jd.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.amazonaws.com%2Fuploads%2Farticles%2Fj64f4v9ci2a7ky2276jd.png" alt="workspace" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a new notebook and start working&lt;/strong&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Install required packages &amp;amp; dependencies
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install openai langchain langchain-community langchain-openai singlestoredb --quiet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Import requiredlLibraries and initialize components
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langchain_openai import OpenAIEmbeddings  # works after installing langchain-openai
from langchain_community.vectorstores import SingleStoreDB
from openai import OpenAI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Set up SingleStore and OpenAI credentials
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SINGLESTORE_HOST = "Add host URL"   # your host
SINGLESTORE_USER = "admin"                     # your user
SINGLESTORE_PASSWORD = "Add your SingleStore DB password"    # your password
SINGLESTORE_DATABASE = "context_engineering"   # your database
OPENAI_API_KEY = "Add your OpenAI API key"
Step 4: Connect to the SingleStore Database
connection_string = f"mysql://{SINGLESTORE_USER}:{SINGLESTORE_PASSWORD}@{SINGLESTORE_HOST}:3306/{SINGLESTORE_DATABASE}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Initialize embeddings and OpenAI client
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;embeddings = OpenAIEmbeddings(api_key=OPENAI_API_KEY)
client = OpenAI(api_key=OPENAI_API_KEY)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Initialize the SingleStore vector database
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langchain_community.vectorstores import SingleStoreDB
from langchain_openai import OpenAIEmbeddings

embeddings = OpenAIEmbeddings(api_key=OPENAI_API_KEY)

vectorstore = SingleStoreDB(
    embedding=embeddings,
    table_name="context_memory",
    host=SINGLESTORE_HOST,
    user=SINGLESTORE_USER,
    password=SINGLESTORE_PASSWORD,
    database=SINGLESTORE_DATABASE,
    port=3306
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 7: Insert knowledge into long-term memory
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs = [
    {"id": "1", "text": "SingleStore unifies SQL and vector search in a single engine."},
    {"id": "2", "text": "Context engineering ensures AI agents always have the right context at the right time."},
    {"id": "3", "text": "SingleStore is ideal for real-time RAG pipelines due to low-latency queries."}
]

# Insert into vector DB
vectorstore.add_texts([d["text"] for d in docs], ids=[d["id"] for d in docs])
print("✅ Knowledge inserted into SingleStore")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 8: Retrieve relevant context
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query = "Why is SingleStore useful for context engineering?"
results = vectorstore.similarity_search(query, k=2)

print("🔹 Retrieved Context:")
for r in results:
    print("-", r.page_content)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 9: Build prompt for LLM
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from openai import OpenAI
client = OpenAI(api_key=OPENAI_API_KEY)

user_input = "Explain context engineering using SingleStore."

context = "\n".join([r.page_content for r in results])

prompt = f"""
You are a helpful AI agent.
User asked: {user_input}
Relevant context from memory:
{context}
"""

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": prompt}]
)

print("🔹 Agent Answer:\n", response.choices[0].message.content)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 10: Store conversation back (short-term → long-term memory)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vectorstore.add_texts([
    f"User: {user_input}", 
    f"Assistant: {response.choices[0].message.content}"
])


print("✅ Conversation stored back into SingleStore for future retrieval")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 11: Test retrieval again
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;followup_query = "What did we discuss earlier about context engineering?"
followup_results = vectorstore.similarity_search(followup_query, k=3)

print("🔹 Follow-up Retrieved Context:")
for r in followup_results:
    print("-", r.page_content)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The complete notebook code is present in this &lt;a href="https://github.com/pavanbelagatti/context-engineering-SingleStore" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;. &lt;/p&gt;

&lt;h4&gt;
  
  
  The future belongs to context-driven AI
&lt;/h4&gt;

&lt;p&gt;As AI systems become more capable, the real differentiator won’t be bigger models — it will be better context. The ability to deliver the right data, at the right time, in the right format will define how useful and reliable AI truly becomes. Context engineering transforms isolated LLMs into intelligent systems that understand, remember and act with purpose.&lt;/p&gt;

&lt;p&gt;By embracing this discipline, developers can move beyond clever prompts and instead build context-aware ecosystems where memory, reasoning and execution work in harmony. Frameworks like LangChain and databases like SingleStore make this vision practical — offering unified storage, hybrid search and high-speed retrieval that bring context to life.&lt;/p&gt;

&lt;p&gt;In short, context engineering isn’t just a new buzzword — it’s the backbone of the next generation of AI. The sooner we master it, the closer we get to building AI systems that don’t just respond, but truly understand.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>agents</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Learn How to Build Robust RAG Applications Using Llama 4!</title>
      <dc:creator>Pavan Belagatti</dc:creator>
      <pubDate>Tue, 08 Apr 2025 06:29:35 +0000</pubDate>
      <link>https://forem.com/singlestore-developer/learn-how-to-build-robust-rag-applications-using-llama-4-2cmg</link>
      <guid>https://forem.com/singlestore-developer/learn-how-to-build-robust-rag-applications-using-llama-4-2cmg</guid>
      <description>&lt;p&gt;Exciting developments are unfolding in the AI landscape with Meta's introduction of the Llama 4 models. This blog will delve into the features and capabilities of these advanced models, including Llama 4 Scout, Llama 4 Maverick, and Llama 4 Behemoth, and provide a step-by-step tutorial on building a robust RAG system using Llama 4 Maverick.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Llama 4 Models
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2F6avwo8yc9he705v0w7nk.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.amazonaws.com%2Fuploads%2Farticles%2F6avwo8yc9he705v0w7nk.png" alt="Llama4 Models"&gt;&lt;/a&gt;&lt;br&gt;
The Llama 4 models from Meta represent a significant leap in artificial intelligence technology. These models are designed to cater to diverse needs, ranging from lightweight tasks to complex data analysis. With a focus on open-source availability, Meta aims to democratize access to advanced AI capabilities, enabling developers and researchers to leverage cutting-edge tools in their projects.&lt;/p&gt;

&lt;p&gt;Llama 4 models stand out due to their versatility and performance. By offering various configurations, they allow users to choose a model that best fits their specific requirements. This flexibility is crucial in a landscape where the demands on AI systems are ever-increasing.&lt;/p&gt;
&lt;h3&gt;
  
  
  Overview of Llama 4 Scout
&lt;/h3&gt;

&lt;p&gt;Llama 4 Scout is the smallest and fastest model in the Llama 4 lineup. It is engineered for efficiency, making it ideal for light AI tasks and applications that require a long memory. With the capability to handle up to ten million tokens of context, Scout leads the industry in context length.&lt;/p&gt;
&lt;h4&gt;
  
  
  Use Cases for Llama 4 Scout
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight AI Tasks&lt;/strong&gt;: Perfect for applications that require quick responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long Memory Applications&lt;/strong&gt;: Its extensive context length allows it to maintain relevant information over extended interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research and Development&lt;/strong&gt;: An excellent choice for prototyping and testing new ideas in AI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Features of Llama 4 Maverick
&lt;/h3&gt;

&lt;p&gt;Llama 4 Maverick is the powerhouse of the Llama 4 series. With 17 million active parameters and 128 experts, it offers unmatched performance in various applications. Its multimodal capabilities allow it to process different types of data seamlessly, making it a top choice for developers.&lt;/p&gt;
&lt;h4&gt;
  
  
  Key Features of Llama 4 Maverick
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High Performance&lt;/strong&gt;: Surpasses similar models, including GPT-4, in speed and reliability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multimodal Capabilities&lt;/strong&gt;: Handles text, images, and other data types efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Suitable for both small-scale projects and large enterprise applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  The Intelligence of Llama 4 Behemoth
&lt;/h3&gt;

&lt;p&gt;Llama 4 Behemoth is described as the smartest model in the series. Though not yet publicly available, it promises to deliver advanced AI capabilities that can handle complex tasks requiring deep understanding and reasoning.&lt;/p&gt;
&lt;h4&gt;
  
  
  Potential Applications of Llama 4 Behemoth
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internal Distillation&lt;/strong&gt;: Ideal for organizations looking to refine their AI models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benchmarking&lt;/strong&gt;: Can serve as a reference point for evaluating other AI models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex Problem Solving&lt;/strong&gt;: Designed for tasks that require higher cognitive functions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Performance Comparison on LM Arena Leaderboard
&lt;/h3&gt;

&lt;p&gt;The performance of Llama 4 models on the LM Arena Leaderboard speaks volumes about their capabilities. Llama 4 Maverick consistently ranks at the top, outperforming models like GPT-4 and DeepSea Carbon.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2Ft5xjllzp16ztiz3xdo94.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.amazonaws.com%2Fuploads%2Farticles%2Ft5xjllzp16ztiz3xdo94.png" alt="LM Arena"&gt;&lt;/a&gt;&lt;br&gt;
Credits: LMArena&lt;/p&gt;
&lt;h4&gt;
  
  
  Insights from the LM Arena Leaderboard
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Top Performer&lt;/strong&gt;: Llama 4 Maverick's performance is unmatched in its class.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Value Proposition&lt;/strong&gt;: Offers superior performance at a competitive cost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-World Applications&lt;/strong&gt;: Demonstrated effectiveness in diverse scenarios, from coding to enterprise solutions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Detailed Model Comparisons
&lt;/h3&gt;

&lt;p&gt;A comprehensive comparison of the Llama 4 models reveals distinct strengths and ideal use cases. Understanding these differences helps users select the right model for their specific needs.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2Fw7ldsftc3trh01fm55l6.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.amazonaws.com%2Fuploads%2Farticles%2Fw7ldsftc3trh01fm55l6.png" alt="models comparison"&gt;&lt;/a&gt;&lt;br&gt;
Credits: Analytics Vidhya&lt;/p&gt;
&lt;h3&gt;
  
  
  Hands-On with Llama 4: Setting Up the RAG System!
&lt;/h3&gt;

&lt;p&gt;Building a RAG (Retrieval-Augmented Generation) system using Llama 4 Maverick is straightforward. This system can efficiently retrieve and generate responses based on user queries.&lt;/p&gt;

&lt;p&gt;We will be using &lt;a href="https://www.langchain.com/" rel="noopener noreferrer"&gt;LangChain&lt;/a&gt;, the open-source LLM framework to build this RAG setup along with &lt;a href="https://portal.singlestore.com/intention/cloud?utm_medium=referral&amp;amp;utm_source=pavan&amp;amp;utm_term=devto&amp;amp;utm_content=Llama4" rel="noopener noreferrer"&gt;SingleStore&lt;/a&gt;.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2Feigbrzsvkfvdr7g0yidz.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.amazonaws.com%2Fuploads%2Farticles%2Feigbrzsvkfvdr7g0yidz.png" alt="RAG Setup with Llama 4 Maverick"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Step-by-Step Guide to Setup
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Choose Your Database&lt;/strong&gt;: Select a vector database such as &lt;a href="https://portal.singlestore.com/intention/cloud?utm_medium=referral&amp;amp;utm_source=pavan&amp;amp;utm_term=devto&amp;amp;utm_content=Llama4" rel="noopener noreferrer"&gt;SingleStore&lt;/a&gt; to store your embeddings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Your Data&lt;/strong&gt;: Ingest a document, such as a PDF file, and create text chunks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create Embeddings&lt;/strong&gt;: Use an embedding model to convert your text chunks into vector embeddings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Store Embeddings&lt;/strong&gt;: Save the vector embeddings in your selected database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Query the Model&lt;/strong&gt;: Convert user queries into vector embeddings and retrieve relevant information from the database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generate Responses&lt;/strong&gt;: Use Llama 4 Maverick to generate contextually relevant responses based on the retrieved data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Initializing Llama 4 Maverick via OpenRouter
&lt;/h5&gt;

&lt;p&gt;Setting up Llama 4 Maverick is straightforward with OpenRouter. This platform provides a user-friendly interface for accessing advanced AI models. Begin by signing up at OpenRouter and creating your API key.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2Fhcibek5cbg43qn7p39vw.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.amazonaws.com%2Fuploads%2Farticles%2Fhcibek5cbg43qn7p39vw.png" alt="OpenRouter"&gt;&lt;/a&gt;&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2F1ur3mhan5h9vovja0w3d.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.amazonaws.com%2Fuploads%2Farticles%2F1ur3mhan5h9vovja0w3d.png" alt="Llama 4 Maverick via OpenRouter"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have your API key, you'll need to configure the model parameters. Adjust settings like temperature and max tokens according to your application's needs. A higher temperature can generate more creative responses, while a lower temperature produces more deterministic outputs.&lt;/p&gt;

&lt;p&gt;After configuration, you can initialize the model. This step involves calling the OpenRouter API with your API key and model parameters, setting the stage for querying and generating responses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Below is my complete RAG hands-on video&lt;/strong&gt;&lt;br&gt;
  &lt;iframe src="https://www.youtube.com/embed/8g2YFQVchZ8"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Here is the complete notebook code repo,&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/pavanbelagatti" rel="noopener noreferrer"&gt;
        pavanbelagatti
      &lt;/a&gt; / &lt;a href="https://github.com/pavanbelagatti/Llama4-RAG-Tutorial" rel="noopener noreferrer"&gt;
        Llama4-RAG-Tutorial
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;RAG Setup Using Llama 4 Maverick &amp;amp; LangChain&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Prerequisites&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.singlestore.com/intention/cloud?utm_medium=referral&amp;amp;utm_source=pavan&amp;amp;utm_term=yt&amp;amp;utm_content=Llama4" rel="nofollow noopener noreferrer"&gt;SingleStore free account&lt;/a&gt; - To use it as a vector database&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://openrouter.ai/" rel="nofollow noopener noreferrer"&gt;OpenRouter free account&lt;/a&gt; - A unified interface for LLMs&lt;/li&gt;
&lt;li&gt;OpenAI API Key - You can use any other models for embeddings (From Huggingface or Cohere, etc)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/pavanbelagatti/Llama4-RAG-Tutorial" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h3&gt;
  
  
  Exploring the Database and Hybrid Search Capabilities
&lt;/h3&gt;

&lt;p&gt;One of the standout features of using a vector database like &lt;a href="https://portal.singlestore.com/intention/cloud?utm_medium=referral&amp;amp;utm_source=pavan&amp;amp;utm_term=devto&amp;amp;utm_content=Llama4" rel="noopener noreferrer"&gt;SingleStore&lt;/a&gt; is its hybrid search capabilities. This functionality allows you to combine traditional keyword searches with semantic searches, enhancing the retrieval process.&lt;/p&gt;

&lt;p&gt;Hybrid search enables you to pull relevant data based on both keyword matches and context relevance. This dual approach ensures that users receive comprehensive results that are both accurate and contextually appropriate.&lt;/p&gt;

&lt;p&gt;Understanding how to leverage these capabilities can significantly enhance your RAG system's performance. Regularly experiment with different search strategies to find the most effective combinations for your use case.&lt;/p&gt;

&lt;h4&gt;
  
  
  Benefits of Hybrid Search using SingleStore
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Increased Accuracy&lt;/strong&gt;: Combines the strengths of keyword and semantic searches for better retrieval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced User Experience&lt;/strong&gt;: Provides users with more relevant results, improving satisfaction and engagement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;: Adapts to growing datasets and evolving user needs without compromising performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Conclusion and Future Prospects
&lt;/h4&gt;

&lt;p&gt;In conclusion, building a RAG system with Llama 4 Maverick is both feasible and rewarding. By effectively ingesting data, creating embeddings, and utilizing advanced querying techniques, you can develop a powerful AI application. The future of RAG systems look promising, with ongoing advancements in AI technology. As models like Llama 4 evolve, they will offer even greater capabilities, making it essential for developers to stay updated with the latest trends and techniques.&lt;/p&gt;

&lt;p&gt;By continuously refining your system and embracing new features, you can ensure your RAG application remains at the forefront of AI innovation. The journey of exploration and development in this field is just beginning, and the possibilities are limitless.&lt;/p&gt;

&lt;p&gt;Try the tutorial and don't forget to &lt;a href="https://portal.singlestore.com/intention/cloud?utm_medium=referral&amp;amp;utm_source=pavan&amp;amp;utm_term=devto&amp;amp;utm_content=Llama4" rel="noopener noreferrer"&gt;sign up to SingleStore&lt;/a&gt; and get your free account.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>opensource</category>
      <category>database</category>
    </item>
  </channel>
</rss>
