blob: efeef98344259455f4f17b3f9bc9bb273cab46ef [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>SAI FAQ | Apache Cassandra Documentation</title>
<link rel="stylesheet" href="../../../../../../../assets/css/site.css">
<meta name="description" content="Frequently asked questions about Storage-Attached Indexing (SAI).">
<link rel="schema.dcterms" href="https://purl.org/dc/terms/">
<meta name="dcterms.subject" content="Cassandra">
<meta name="dcterms.identifier" content="5.0">
<meta name="generator" content="Antora 2.3.4">
<link rel="icon" href="../../../../../../../assets/img/favicon.ico" type="image/x-icon">
<script>
const script = document.createElement("script");
const domain = window.location.hostname;
script.type = "text/javascript";
script.src = "https://plausible.cassandra.apache.org/js/plausible.js";
script.setAttribute("data-domain",domain);
script.setAttribute("defer",'true');
script.setAttribute("async",'true');
document.getElementsByTagName("head")[0].appendChild(script);
</script> </head>
<body class="docs-wrapper article">
<div class="container mx-auto relative">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<meta property="og:type" content="website" />
<meta property="og:description" content="" />
<meta property="og:url" content="/" />
<meta property="og:site_name" content="Apache Cassandra" />
<header id="top-nav">
<div class="inner relative">
<div class="header-social-icons text-right">
<a href="https://twitter.com/cassandra?lang=en" target="_blank" styles="margin-left: 20px;"><img src="../../../../../../../assets/img/twitter-icon-circle-white.svg" alt="twitter icon" width="24"></a>
<a href="https://www.linkedin.com/company/apache-cassandra/" target="_blank" styles="margin-left: 20px;"><img src="../../../../../../../assets/img/LI-In-Bug.png" alt="linked-in icon" width="24"></a>
<a href="https://www.youtube.com/c/PlanetCassandra" target="_blank" styles="margin-left: 20px;"><img src="../../../../../../../assets/img/youtube-icon.png" alt="youtube icon" width="24"></a>
</div>
<div class="cf">
<div class="logo left"><a href="/"><img src="../../../../../../../assets/img/logo-white-r.png" alt="Cassandra Logo"></a></div>
<div class="mobile-nav-icon right">
<img class="toggle-icon" src="../../../../../../../assets/img/hamburger-nav.svg">
</div>
<ul class="main-nav nav-links right flex flex-vert-center flex-space-between">
<li>
<a class="nav-link hide-mobile">Get Started</a>
<ul class="sub-menu bg-white">
<li class="pa-micro">
<a href="/_/cassandra-basics.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-basics.png" alt="cassandra basics icon">
</div>
<div class="sub-nav-text teal py-small">
Cassandra Basics
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/quickstart.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-rocket.png" alt="cassandra basics icon">
</div>
<div class="sub-nav-text teal py-small">
Quickstart
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/ecosystem.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-ecosystem.png" alt="cassandra basics icon">
</div>
<div class="sub-nav-text teal py-small">
Ecosystem
</div>
</a>
</li>
</ul>
</li>
<li><a class="nav-link" href="/doc/latest/">Documentation</a></li>
<li>
<a class="nav-link" href="/_/community.html">Community</a>
<ul class="sub-menu bg-white">
<li class="pa-micro">
<a href="/_/community.html#code-of-conduct">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-welcome.png" alt="welcome icon">
</div>
<div class="sub-nav-text teal py-small">
Welcome
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#discussions">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-discussions.png" alt="discussions icon">
</div>
<div class="sub-nav-text teal py-small">
Discussions
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#project-governance">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-governance.png" alt="Governance icon">
</div>
<div class="sub-nav-text teal py-small">
Governance
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#how-to-contribute">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-contribute.png" alt="Contribute icon">
</div>
<div class="sub-nav-text teal py-small">
Contribute
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#meet-the-community">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-community.png" alt="Meet the Community icon">
</div>
<div class="sub-nav-text teal py-small">
Meet the Community
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/cassandra-catalyst-program.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-catalyst.png" alt="Catalyst icon">
</div>
<div class="sub-nav-text teal py-small">
Catalyst Program
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/events.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-events.png" alt="Events icon">
</div>
<div class="sub-nav-text teal py-small">
Events
</div>
</a>
</li>
</ul>
</li>
<li>
<a class="nav-link hide-mobile">Learn</a>
<ul class="sub-menu bg-white">
<li class="pa-micro">
<a href="/_/Apache-Cassandra-5.0-Moving-Toward-an-AI-Driven-Future.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-basics.png" alt="Basics icon">
</div>
<div class="sub-nav-text teal py-small">
Cassandra 5.0
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/case-studies.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-case-study.png" alt="Case Studies icon">
</div>
<div class="sub-nav-text teal py-small">
Case Studies
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/resources.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-resources.png" alt="Resources icon">
</div>
<div class="sub-nav-text teal py-small">
Resources
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/blog.html">
<div class="sub-nav-icon">
<img src="../../../../../../../assets/img/sub-menu-blog.png" alt="Blog icon">
</div>
<div class="sub-nav-text teal py-small">
Blog
</div>
</a>
</li>
</ul>
</li>
<li><a class="nav-link btn btn--filled" href="/_/download.html">Download Now</a></li>
</ul>
</div>
</div>
</header>
<div class="hero hero--home grad">
<div class="eye"></div>
<div id="docs-content" class="text-center flex flex-center flex-column relative z2 ma-xlarge">
<h2>Cassandra Documentation</h2>
</div>
</div>
<div class="body px-medium py-medium container">
<div class="docs-nav-bar flex flex-space-between mb-medium">
<div id="mobile-docs-nav-burger" class="hidden">
<svg viewBox="0 0 24 24" width="36" height="36" stroke="#1c81a0" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
</div>
<div class="docs-nav-item relative">
<input id="search-input" type="text" placeholder="Search docs">
</div>
<div class="versions-wrapper">
<h4>Version:</h4>
<div class="nav-panel-explore" data-panel="explore">
<div id="version-toggle" class="context">
<span class="version">5.0</span>
</div>
<ul id="versions-list" class="components">
<li class="component">
<ul class="versions">
<li class="version is-latest">
<a href="../../../../../../../_/index.html">master</a>
</li>
</ul>
</li>
<li class="component is-current">
<ul class="versions">
<li class="version">
<a href="../../../../../../trunk/index.html">trunk</a>
</li>
<li class="version is-current">
<a href="../../../../../index.html">5.0</a>
</li>
<li class="version is-latest">
<a href="../../../../../../4.1/index.html">4.1</a>
</li>
<li class="version">
<a href="../../../../../../4.0/index.html">4.0</a>
</li>
<li class="version">
<a href="../../../../../../3.11/index.html">3.11</a>
</li>
</ul>
</li>
</ul>
</div>
</div> </div>
<div class="cf relative">
<nav class="nav docs-nav full-800">
<div class="nav-menu">
<ul class="nav-list">
<li class="nav-item is-active" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../../index.html">Main</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/glossary.html">Glossary</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/bugs.html">How to report bugs</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/contactus.html">Contact us</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../../../../_/development/index.html">Development</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/gettingstarted.html">Getting started</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/ide.html">Building and IDE integration</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/testing.html">Testing</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/patches.html">Contributing code changes</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/code_style.html">Code style</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/how_to_review.html">Review checklist</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/how_to_commit.html">How to commit</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/documentation.html">Working on documentation</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/ci.html">Jenkins CI environment</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/dependencies.html">Dependency management</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../../../_/development/release_process.html">Release process</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item is-active" data-depth="0">
<ul class="nav-list">
<li class="nav-item is-current-path is-active" data-depth="1">
<span class="nav-line">
<button class="nav-toggle"></button>
<span class="nav-text">Cassandra</span>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../overview/faq/index.html">FAQ</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../getting-started/index.html">Getting Started</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/cassandra-quickstart.html">Cassandra Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/sai-quickstart.html">SAI Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/vector-search-quickstart.html">Vector Search Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../installing/installing.html">Installing Cassandra</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/configuring.html">Configuring Cassandra</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/querying.html">Inserting and querying</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/drivers.html">Client drivers</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/production.html">Production recommendations</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../new/index.html">What&#8217;s new</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/java17.html">Support for Java</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../architecture/index.html">Architecture</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../architecture/overview.html">Overview</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../architecture/dynamo.html">Dynamo</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../architecture/storage-engine.html">Storage Engine</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../architecture/guarantees.html">Guarantees</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../architecture/messaging.html">Improved Internode Messaging</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../architecture/streaming.html">Improved Streaming</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../data-modeling/index.html">Data Modeling</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/intro.html">Introduction</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_conceptual.html">Conceptual data modeling</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_rdbms.html">RDBMS design</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_queries.html">Defining application queries</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_logical.html">Logical data modeling</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_physical.html">Physical data modeling</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_refining.html">Evaluating and refining data models</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_schema.html">Defining database schema</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../data-modeling/data-modeling_tools.html">Cassandra data modeling tools</a>
</span>
</li>
</ul>
</li>
<li class="nav-item is-current-path is-active" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../index.html">Cassandra Query Language (CQL)</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../definitions.html">Definitions</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../types.html">Data types</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../ddl.html">Data definition (DDL)</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../dml.html">Data manipulation (DML)</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../dynamic-data-masking.html">Dynamic Data Masking (DDM)</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../operators.html">Operators</a>
</span>
</li>
<li class="nav-item is-current-path is-active" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../indexing-concepts.html">Indexing concepts</a>
</span>
<ul class="nav-list">
<li class="nav-item is-current-path is-active" data-depth="4">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="sai-overview.html">SAI Overview</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="sai-concepts.html">Concepts</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/sai-quickstart.html">SAI Quickstart</a>
</span>
</li>
<li class="nav-item is-current-page is-active" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="sai-faq.html">SAI FAQ</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="sai-working-with.html">Working with SAI</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="operations/sai-operations.html">SAI operations</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../2i/2i-overview.html">Secondary indexes (2i) overview</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../2i/2i-concepts.html">Concepts</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../2i/2i-working-with.html">Working with 2i</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../2i/operations/2i-build.html">Rebuild 2i</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../mvs.html">Materialized views</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../functions.html">Functions</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../json.html">JSON</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../security.html">Security</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../triggers.html">Triggers</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../appendices.html">Appendices</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../changes.html">Changes</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../SASI.html">SASI</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../cql_singlefile.html">Single file of CQL information</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../vector-search/overview.html">Vector Search overview</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../vector-search/concepts.html">Concepts</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../vector-search/data-modeling.html">Data Modeling</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../getting-started/vector-search-quickstart.html">Vector Search Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../vector-search/vector-search-working-with.html">Working with Vector Search</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../managing/index.html">Managing</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../managing/configuration/index.html">Configuring</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_yaml_file.html">cassandra.yaml</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_rackdc_file.html">cassandra-rackdc.properties</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_env_sh_file.html">cassandra-env.sh</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_topo_file.html">cassandra-topologies.properties</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_cl_archive_file.html">commitlog-archiving.properties</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_logback_xml_file.html">logback.xml</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/cass_jvm_options_file.html">jvm-* files</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/configuration/configuration.html">Liberating cassandra.yaml Parameters' Names from Their Units</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../managing/operating/index.html">Operating</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/backups.html">Backups</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/bloom_filters.html">Bloom filters</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/bulk_loading.html">Bulk loading</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/cdc.html">Change Data Capture (CDC)</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/compaction/index.html">Compaction</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/compression.html">Compression</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/hardware.html">Hardware</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/hints.html">Hints</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../managing/operating/logging.html">Logging</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/auditlogging.html">Audit logging</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/audit_logging.html">Audit logging 2</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/fqllogging.html">Full query logging</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/metrics.html">Monitoring metrics</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/repair.html">Repair</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/read_repair.html">Read repair</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/security.html">Security</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/snitch.html">Snitches</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/topo_changes.html">Topology changes</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/transientreplication.html">Transient replication</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/operating/virtualtables.html">Virtual tables</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../managing/tools/index.html">Tools</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/tools/cqlsh.html">cqlsh: the CQL shell</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/tools/nodetool/nodetool.html">nodetool</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../../../managing/tools/sstable/index.html">SSTable tools</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="#cassandra:managing/tools/cassandra_stress.adoc">cassandra-stress</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../troubleshooting/index.html">Troubleshooting</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../troubleshooting/finding_nodes.html">Finding misbehaving nodes</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../troubleshooting/reading_logs.html">Reading Cassandra logs</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../troubleshooting/use_nodetool.html">Using nodetool</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../troubleshooting/use_tools.html">Using external tools to deep-dive</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../reference/index.html">Reference</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/cql-commands/alter-table.html">ALTER TABLE</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/cql-commands/create-index.html">CREATE INDEX</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/cql-commands/create-custom-index.html">CREATE CUSTOM INDEX</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/cql-commands/create-table.html">CREATE TABLE</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/cql-commands/drop-index.html">DROP INDEX</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../reference/cql-commands/drop-table.html">DROP TABLE</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../integrating/plugins/index.html">Plug-ins</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<aside class="toc sidebar">
<div class="toc-menu"></div>
</aside>
<main class="article default-main full-800" data-ceiling="topbar">
<div class="article-banner">
<p>You are viewing the documentation for a prerelease version.</p>
</div>
<div class="article-header">
<nav class="crumbs" aria-label="breadcrumbs">
<ul>
<li class="crumb">Cassandra</li>
<li class="crumb"><a href="../../index.html">Cassandra Query Language (CQL)</a></li>
<li class="crumb"><a href="../indexing-concepts.html">Indexing concepts</a></li>
<li class="crumb"><a href="sai-overview.html">SAI Overview</a></li>
<li class="crumb"><a href="sai-faq.html">SAI FAQ</a></li>
</ul>
</nav>
<div class="tools" role="navigation">
<ul>
<li class="tool edit"><a href="https://github.com/apache/cassandra/edit/cassandra-5.0/doc/modules/cassandra/pages/developing/cql/indexing/sai/sai-faq.adoc" title="Edit Page" target="_blank" rel="noopener">Edit</a></li>
</ul>
</div>
</div>
<article class="doc">
<h1 class="page">SAI FAQ</h1>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Use this FAQ to find answers to common questions and get help with Storage-Attached Indexing (SAI).</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-is-sai"><a class="anchor" href="#what-is-sai"></a>What is SAI?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Storage-Attached Indexing (SAI) is a highly-scalable, globally-distributed index for the Cassandra database.
SAI combines:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>the storage-attached architecture of open source SSTable Attached Secondary Indexes (SASI)</p>
</li>
<li>
<p>a number of highly optimized on-disk index structures</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="which-databases-are-supported"><a class="anchor" href="#which-databases-are-supported"></a>Which databases are supported?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Cassandra 5.0 is the only supported database currently.</p>
</div>
<div class="paragraph">
<p>After creating your database, a keyspace, and one or more tables, use <code>CREATE INDEX ...
USING 'sai'</code> to define one or more SAI indexes on the table.
For Cassandra databases, use <code>cqlsh</code>.
The same <code>CREATE INDEX ...
USING 'sai'</code> command is available for both.
See <a href="../../../../getting-started/sai-quickstart.html" class="page">SAI quickstart</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-configuration-settings-should-i-use-with-sai"><a class="anchor" href="#what-configuration-settings-should-i-use-with-sai"></a>What configuration settings should I use with SAI?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Compared with most indexing environments, SAI configuration and related settings are much simpler.
Key points:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Increase <code>--XX:MaxDirectMemorySize</code>, leaving approximately 15-20% of memory for the OS and other in-memory structures.</p>
</li>
<li>
<p>In cassandra.yaml, explicitly set <code>file_cache_size_in_mb</code> to 75% of that value.</p>
</li>
<li>
<p>Heavy mixed read/write workloads may want to:</p>
<div class="ulist">
<ul>
<li>
<p>Decrease <code>range_request_timeout_in_ms</code></p>
</li>
<li>
<p>Increase <code>write_request_timeout_in_ms</code></p>
</li>
</ul>
</div>
</li>
<li>
<p>If the <code>memtable_flush_writers</code> value is set too low, writes may stall.
If this occurs in your environment, increase <code>memtable_flush_writers</code>.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Aside from memory, SAI uses the same tunable parameters for Cassandra, such as compaction throughput and compaction executors.
This matters for write performance.
For read performance, again, maximizing use of the Chunk Cache will benefit SAI reads because all on-disk index components are accessed through this mechanism.
Refer to <a href="operations/configuring.html" class="page">Configure SAI indexes</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-computing-challenges-does-sai-solve"><a class="anchor" href="#what-computing-challenges-does-sai-solve"></a>What computing challenges does SAI solve?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Oftentimes, developers ask: "How can I query additional fields outside of the Apache Cassandra partition key?"</p>
</div>
<div class="paragraph">
<p>SAI implements efficient indexes based on a table&#8217;s columns, such as parts of a composite partition key.
Before SAI, you could index clustering keys, but you could not index parts of a composite partition.
The development of SAI was inspired by SASI to achieve the goal of efficient and simpler filtering via the creation of secondary indexes.</p>
</div>
<div class="paragraph">
<p>SAI also makes data modeling easier because you do not need to create custom tables just to cater to particular query patterns.
You can create a table that is most natural for you, write to just that table, and query it any way you want.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-are-the-advantages-of-using-sai"><a class="anchor" href="#what-are-the-advantages-of-using-sai"></a>What are the advantages of using SAI?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI makes it possible to define multiple indexes on the same database table.
Each SAI index can be based on any column in the table.
Exception: there is no need to define an SAI index based on the partition key when it&#8217;s comprised of only one column;
in this case, SAI issues an <code>invalid query</code> message.
You can also define an SAI index using a single column in the table&#8217;s composite partition key.
A composite partition key means that the partition is based on two or more columns.
In this case with an SAI index, you would specify just one of the columns that comprises the composite partition key.</p>
</div>
<div class="paragraph">
<p>For developers, SAI removes several previous pain points, including the need to duplicate denormalized data to query non-PrimaryKey columns.</p>
</div>
<div class="paragraph">
<p>For operators, SAI has several advantages, including the use of significantly less disk space for indexing;
fewer failure points;
easier uptime due to the simplified architecture of SAI;
and fewer copies of data to secure.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="is-sai-a-complete-search-solution"><a class="anchor" href="#is-sai-a-complete-search-solution"></a>Is SAI a complete search solution?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI is not an enterprise search engine.
While it does provide some of the same functionality, SAI is not a complete replacement for text-based search.
At its core, SAI is a filtering engine, and simplifies data modeling and client applications that would otherwise rely heavily on maintaining multiple query-specific tables.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="how-does-schema-management-compare-between-sai-and-text-based-search"><a class="anchor" href="#how-does-schema-management-compare-between-sai-and-text-based-search"></a>How does schema management compare between SAI and text-based search?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI is an index, not a search engine.
Unlike the text-based search, SAI has no need for schema management.
SAI configuration is simpler and is tuned with existing database parameters, such as in cassandra.yaml.
With SAI, there is no commit log to accept writes during bootstrap;
SAI does not need to wait for bootstrap to read the database configuration.
With SAI, schema/indexing options reside in the index metadata, which is handled by native database schema management.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="how-do-i-use-sai-features"><a class="anchor" href="#how-do-i-use-sai-features"></a>How do I use SAI features?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Storage-Attached Indexing has queries are entirely CQL-based.
The features, by design, are intentionally simple and easy to use.</p>
</div>
<div class="paragraph">
<p>At a high level, SAI indexes are:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Created and dropped per column via CQL <code>CREATE INDEX ...
USING 'sai'</code> commands and <code>DROP INDEX</code> commands.
Start in <a href="../../../../getting-started/sai-quickstart.html" class="page">SAI quickstart</a>.</p>
</li>
<li>
<p>Rebuilt and backed up via nodetool.
See <a href="../../../../managing/tools/nodetool/nodetool.html" class="page">nodetool</a>.</p>
</li>
<li>
<p>Monitored via a combination of nodetool, CQL virtual tables, system metrics, and JMX.
See <a href="operations/monitoring.html" class="page">Monitor SAI indexes</a>.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="on-which-column-in-a-database-table-can-i-base-an-sai-index"><a class="anchor" href="#on-which-column-in-a-database-table-can-i-base-an-sai-index"></a>On which column in a database table can I base an SAI index?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Define each SAI index on any table column.
Exception: there is no need to define an SAI index based on the partition key when it&#8217;s comprised of only one column;
in this case, SAI issues an <code>invalid query</code> message.</p>
</div>
<div class="paragraph">
<p>You can also define an SAI index using a single column in the table&#8217;s composite partition key.
A composite partition key means that the partition is based on two or more columns.
In this case with an SAI index, you would specify just one of the columns that comprises the composite partition key.</p>
</div>
<div class="paragraph">
<p>With collection maps, you can define one or more SAI indexes on the same column, specifying <code>keys</code>, <code>values</code>, and <code>entries</code> as map types.
SAI also supports <code>list</code> and <code>set</code> collections.</p>
</div>
<div class="openblock">
<div class="content">
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>In CQL queries of database tables with SAI indexes, the <code>CONTAINS</code> clauses
are supported with, and specific to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>SAI <strong>collection maps</strong> with <code>keys</code>, <code>values</code>, and <code>entries</code></p>
</li>
<li>
<p>SAI <strong>collections</strong> with <code>list</code> and <code>set</code> types</p>
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="when-i-drop-and-recreate-an-sai-index-on-the-same-column-does-that-block-any-read-operations-and-is-there-a-way-to-check-the-indexing-status"><a class="anchor" href="#when-i-drop-and-recreate-an-sai-index-on-the-same-column-does-that-block-any-read-operations-and-is-there-a-way-to-check-the-indexing-status"></a>When I <code>DROP</code> and recreate an SAI index on the same column, does that block any read operations? And is there a way to check the indexing status?</h2>
<div class="sectionbody">
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>When you <code>DROP</code> / recreate an SAI index, you are not blocked from entering queries that do not use the index.
However, you cannot use that SAI index (based on the same column) until it has finished building and is queryable.
To determine the current state of a given index, query the <code>system_views.indexes</code> virtual table.
Example:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">SELECT is_queryable,is_building FROM system_views.indexes WHERE keyspace_name='keyspace'
AND table_name='table' AND index_name='index';</code></pre>
</div>
</div>
</div>
</div>
<div class="paragraph">
<p>See <a href="operations/monitoring.html#saiMonitorVirtualTables" class="page">Virtual tables</a> and <a href="../../../../reference/sai-virtual-table-indexes.html" class="page">Virtual tables for SAI indexes and SSTables</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-are-the-write-and-read-paths-used-by-sai-indexes"><a class="anchor" href="#what-are-the-write-and-read-paths-used-by-sai-indexes"></a>What are the write and read paths used by SAI indexes?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI indexes Memtables and SSTables as they are written, resolving the differences between those indexes at read time.
See <a href="sai-read-write-paths.html" class="page">SAI write path and read path</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-on-disk-index-formats-does-sai-support"><a class="anchor" href="#what-on-disk-index-formats-does-sai-support"></a>What on-disk index formats does SAI support?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI supports two on-disk index formats, optimized for:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Equality and non-exact matching on <strong>strings</strong>.</p>
<div class="ulist">
<ul>
<li>
<p>Strings are indexed on-disk using the <a href="https://en.wikipedia.org/wiki/Trie">trie</a> data structure, in conjunction with postings (term/row pairs) lists.
The trie is heap friendly, providing string prefix compression for terms, and can match any query that can be expressed as a deterministic finite automaton.
The feature minimizes on-disk footprint and supports simple token skipping.</p>
</li>
</ul>
</div>
</li>
<li>
<p>Equality and range queries on <strong>numeric and non-literal types</strong>.</p>
<div class="ulist">
<ul>
<li>
<p>Numeric values and the other non-literal CQL types (<code>timestamp</code>, <code>date</code>, <code>UUID</code>) are indexed on-disk using <a href="https://en.wikipedia.org/wiki/K-d_tree">k-dimensional tree</a>, a balanced structure that provides fast lookups across one or more dimensions, and compression for both values and postings.</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-is-the-disk-footprint-overhead-for-sai-indexes"><a class="anchor" href="#what-is-the-disk-footprint-overhead-for-sai-indexes"></a>What is the disk footprint overhead for SAI indexes?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI requires significantly lower disk usage compared to other native or bolt-on Cassandra index solutions.
SAI produces an additional 20-35% disk usage compared with <strong>unindexed</strong> data.
The SAI disk usage is largely dependent on the underlying data model and the number of columns indexed.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-are-the-supported-column-data-types-for-sai-indexing"><a class="anchor" href="#what-are-the-supported-column-data-types-for-sai-indexing"></a>What are the supported column data types for SAI indexing?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The supported types are: <code>ASCII, BIGINT, DATE, DECIMAL, DOUBLE, FLOAT, INET, INT, SMALLINT, TEXT, TIME, TIMESTAMP, TIMEUUID, TINYINT, UUID, VARCHAR, VARINT</code>.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="ulist">
<ul>
<li>
<p><code>INET</code> support for IPv4 and IPv6 was new starting with Cassandra ???.</p>
</li>
<li>
<p>The <code>DECIMAL</code> and <code>VARINT</code> support was new starting with Cassandra ???.</p>
</li>
<li>
<p>SAI also supports collections&#8201;&#8212;&#8201;see the <a href="#saiCollectionColumnFaq">next FAQ</a>.</p>
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="saiCollectionColumnFaq"><a class="anchor" href="#saiCollectionColumnFaq"></a>Does SAI support indexes on a collection column?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Yes&#8201;&#8212;&#8201;SAI supports collections of type <code>map</code>, <code>list</code>, and <code>set</code>.
See the following topics:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="collections.html" class="page">Using collections with SAI</a></p>
</li>
</ul>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>In CQL queries of database tables with SAI indexes, the <code>CONTAINS</code> clauses
are supported with, and specific to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>SAI <strong>collection maps</strong> with <code>keys</code>, <code>values</code>, and <code>entries</code></p>
</li>
<li>
<p>SAI <strong>collections</strong> with <code>list</code> and <code>set</code> types</p>
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-are-the-supported-query-operators"><a class="anchor" href="#what-are-the-supported-query-operators"></a>What are the supported query operators?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>For queries on tables with SAI indexes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Numerics: <code>=</code>, <code>&lt;</code>, <code>&gt;</code>, <code>&#8656;</code>, <code>&gt;=</code>, <code>AND</code>, <code>OR</code>, <code>IN</code></p>
</li>
<li>
<p>Strings: <code>=</code>, <code>CONTAINS</code>, <code>CONTAINS KEY</code>, <code>AND</code>, <code>OR</code>, <code>IN</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The unsupported query operators are:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Strings or Numerics: <code>LIKE</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Examples:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">SELECT * FROM cycling.cyclist_semi_pro WHERE registration &gt; '2010-01-01' AND registration &lt; '2015-12-31' LIMIT 10;</code></pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">SELECT * FROM audit WHERE text_map CONTAINS KEY 'Giovani';</code></pre>
</div>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>For query examples with <code>CONTAINS</code> clauses that take advantage of SAI collection maps, lists, and sets, be sure to see <a href="collections.html" class="page">SAI collection map examples with keys, values, and entries</a>.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="on-the-create-index-command-for-sai-what-options-are-available"><a class="anchor" href="#on-the-create-index-command-for-sai-what-options-are-available"></a>On the <code>CREATE INDEX</code> command for SAI, what options are available?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Use the <code>WITH OPTIONS</code> clause to indicate how SAI should handle case sensitivity and special characters in the index.
For example, given a string column <code>lastname</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">CREATE INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname)
USING 'sai' WITH OPTIONS =
{'case_sensitive': 'false', 'normalize': 'true', 'ascii': 'true'};</code></pre>
</div>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>SAI has an <code>ascii</code> option.
The default is <code>false</code>.
When set to <code>true</code>, SAI converts alphabetic, numeric, and symbolic characters that are not in the Basic Latin Unicode block (the first 127 ASCII characters) to the ASCII equivalent, if one exists.
For example, this option changes <code>à</code> to <code>a</code>.</p>
</div>
<div class="paragraph">
<p>See <a href="../../../../reference/cql-commands/create-custom-index.html" class="page">CREATE CUSTOM INDEX</a> and examples in the <a href="../../../../getting-started/sai-quickstart.html" class="page">SAI quickstart</a> topic.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="does-sai-support-composite-indexing-meaning-a-single-index-on-multiple-columns"><a class="anchor" href="#does-sai-support-composite-indexing-meaning-a-single-index-on-multiple-columns"></a>Does SAI support composite indexing: meaning, a single index on multiple columns?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>No.
There is a 1-to-1 mapping of an SAI index to a column.
However, you can create a separate index on each column in a given table.
Also, SAI can use multiple defined indexes within a single read query.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="how-can-i-view-sai-memory-usage-metrics"><a class="anchor" href="#how-can-i-view-sai-memory-usage-metrics"></a>How can I view SAI memory usage metrics?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The SAI memory footprint is divided between the JVM heap and the Chunk Cache.
The heap stores memtable indexes, and the chunk cache stores recently accessed on-disk index components as well as other SSTable components.
SAI provides metrics for both the heap and the chunk cache.
For each index, SAI also provides metrics for determining the size in bytes of memory used by the on-disk data structure, as well as disk usage.
Refer to <a href="operations/monitoring.html#saiIndexGroupMetrics" class="page">Index group metrics</a>.
SAI also provides Table state metrics that give you visibility into the disk usage, the percentage of disk usage of the base table, the index builds in progress, and related metrics.
See <a href="operations/monitoring.html#saiTableStateMetrics" class="page">Table state metrics</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="saiAndQueriesFaq"><a class="anchor" href="#saiAndQueriesFaq"></a>What is the performance impact of adding SAI columns to a read query? How many <code>AND</code> clauses can I add?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>There is no limit on the number of index columns that can be used in a single query.
The <code>sai_indexes_per_table_failure_threshold</code> setting in cassandra.yaml controls the maximum number of SAI indexes allowed in a single table (10, by default).
However, querying against multiple indexed columns incurs a cost that is related to the increased number of index components processed.
When evaluating multiple indexed columns in a query, SAI performs a workflow (1: Traverse.
2: Merged.
3: Intersect that ultimately coalesces data from multiple memtables and SSTables.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>In a query, AND queries will process up to two SAI indexes;
if more than two SAI indexes are used by the query, this circumstance will result in SAI performing post-filtering on the remaining clauses.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>For related information, see the <a href="sai-read-write-paths.html#saiMatchStreamingAndPostFiltering" class="page">match streaming and post filtering</a> example.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="saiWritesSyncFaq"><a class="anchor" href="#saiWritesSyncFaq"></a>Are SAI write operations asynchronous, or does SAI wait before acknowledging the write to the user?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The SAI write path is actually very simple.
The indexes live with the data, both in memtables and SSTables.
When a write is acknowledged to the client, the data is already indexed.
This is a <strong>synchronous</strong> process.
When the memtable is flushed, the indexes are flushed as well.
See <a href="sai-read-write-paths.html" class="page">SAI write path and read path</a>.</p>
</div>
<div class="paragraph">
<p>The on-disk index components are broken down into per-SSTable index files and per-column index files.
The column indexes do not store the primary keys or tokens;
instead, they store compressible row IDs.
The per-SSTable index files link the row IDs from the column-indexes to their backing SSTables.
This SAI design allows all column indexes within a single SSTable to share per-SSTable index files, which further helps reduce the disk footprint.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-are-the-guidelines-regarding-column-cardinality-with-sai-indexes"><a class="anchor" href="#what-are-the-guidelines-regarding-column-cardinality-with-sai-indexes"></a>What are the guidelines regarding column cardinality with SAI indexes?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Column <a href="https://en.wikipedia.org/wiki/Cardinality_(SQL_statements)">cardinality</a> can affect read performance when it comes to range queries among replicas.
The number of rows matching a value of a high-cardinality column, such as credit card numbers, is more likely to be isolated on very few nodes (or even isolated to one node), while the rows matching a value on a low-cardinality column are more likely to reside on numerous nodes.
If a query does not specify a partition key, the Cassandra coordinator scans the token ring and group token ranges by endpoints (nodes).
The coordinator then concurrently execute read commands for all participating endpoints.
In the worst case where the indexed column has very high cardinality, an entire cluster scan may be required before finding a match.
With low-cardinality columns, be aware that if your <code>LIMIT</code> is higher than the number of values in your targeted column, Cassandra has to search all replicas again before determining that the <code>LIMIT</code> cannot be satisfied.
In this case, Cassandra returns only the number of matching results.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-are-the-circumstances-under-which-sai-applies-post-filtering"><a class="anchor" href="#what-are-the-circumstances-under-which-sai-applies-post-filtering"></a>What are the circumstances under which SAI applies post filtering?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI applies post-filtering in numerous scenarios.
For example, consider a simple table, and an SAI index on just one of the two non-PK columns:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">CREATE KEYSPACE test WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};
CREATE TABLE test.mytable (id int PRIMARY KEY,
col1 text,
col2 timestamp);
CREATE CUSTOM INDEX mytable_col1_idx ON test.mytable (col1) USING 'StorageAttachedIndex';</code></pre>
</div>
</div>
<div class="paragraph">
<p>Given a query such as the following:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">SELECT * FROM test.mytable WHERE col1 = 'hello world' and col2 &lt; toTimestamp(now()) ALLOW FILTERING;</code></pre>
</div>
</div>
<div class="paragraph">
<p>For this query, Cassandra narrows down the search by the indexed column (<code>col1</code>) first, then applies post-filtering on <code>col2</code>.
(Use the <code>ALLOW FILTERING</code> clause with caution.) In this scenario, no additional replica roundtrips are needed;
the post filtering on <code>col2</code> is carried out on the replicas themselves.</p>
</div>
<div class="paragraph">
<p>Another case were post-filtering comes into play is when constructing a query that involves more than two SAI indexes.
Refer to this <a href="#saiAndQueriesFaq">related FAQ</a> about <code>AND</code> queries.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="can-i-create-an-sai-index-based-on-a-static-column"><a class="anchor" href="#can-i-create-an-sai-index-based-on-a-static-column"></a>Can I create an SAI index based on a <a href="#reference:static.adoc" class="page unresolved">static column</a>?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Yes.
For example, consider a <code>transaction_by_customer</code> table where you have a primary key <code>customer_id</code>, plus static columns to contain each customer&#8217;s <code>address</code>, <code>phone_number</code>, and <code>date_of_birth</code>.
Given a query like:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-language-cql hljs" data-lang="language-cql">SELECT * from transaction_by_customer where customer_id = 'xyz123';</code></pre>
</div>
</div>
<div class="paragraph">
<p>If there are 100,000 <code>transaction_by_customer</code> rows, because you defined those three static fields, this query runs against a table that uses significantly less disk space, as compared to an environment where writes had inserted the per-customer values (<code>address</code>, <code>phone_number</code>, <code>date_of_birth</code>) in every row.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>SAI delivers the option and advantage of creating indexes based on static columns, while also achieving the benefit of conserving table space.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="for-indexed-strings-how-does-sai-handle-unicode-characters-in-the-column-data"><a class="anchor" href="#for-indexed-strings-how-does-sai-handle-unicode-characters-in-the-column-data"></a>For indexed strings, how does SAI handle Unicode characters in the column data?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>When you create an SAI index based on a string column, set the <code>normalize</code> option to <code>true</code> if you want SAI to perform Unicode normalization on the column data.
SAI supports Normalization Form C (NFC) Unicode.
When set to <code>true</code>, SAI normalizes the different versions of a given Unicode character to a single version, retaining all the marks and symbols in the index.
For example, SAI would change the character Å (U+212B) to Å (U+00C5).
See <a href="../../../../reference/cql-commands/create-custom-index.html" class="page">CREATE CUSTOM INDEX</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="can-the-indexs-column-name-have-special-characters"><a class="anchor" href="#can-the-indexs-column-name-have-special-characters"></a>Can the index&#8217;s column name have special characters?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI validates the column name on which an index is being defined.
SAI allows alphanumeric characters and underscores only.
SAI returns <code>InvalidRequestException</code> if you try to define an index on a column name that contains other characters, and does not create the index.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-partitioner-does-sai-support"><a class="anchor" href="#what-partitioner-does-sai-support"></a>What partitioner does SAI support?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>SAI supports only the <code>Murmur3Partitioner</code>.</p>
</div>
</div>
</div>
</article>
</main>
</div>
</div>
<footer class="grad grad--two flex-center pb-xlarge">
<div class="inner text-center z2 relative">
<h2 class="white py-small">Get started with Cassandra, fast.</h2>
<a id="footer-cta" href="/_/quickstart.html" class="btn btn--filled ma-medium">Quickstart Guide</a>
</div>
<div class="inner flex flex-distribute-items mt-xlarge z2 relative">
<div class="col-2">
<div id="footer-logo" class="logo logo--footer mb-medium"><img src="../../../../../../../assets/img/logo-white-r.png" alt="Cassandra Logo"></div>
<p>Apache Cassandra<img src="../../../../../../../assets/img/registered.svg" alt="®" style="width:18px;"> powers mission-critical deployments with improved performance and unparalleled levels of scale in the cloud.</p>
<div class="footer-social-icons">
<a href="https://twitter.com/cassandra?lang=en" target="_blank"><img src="../../../../../../../assets/img/twitter-icon-circle-white.svg" alt="twitter icon" width="24"></a>
<a href="https://www.linkedin.com/company/apache-cassandra/" target="_blank"><img src="../../../../../../../assets/img/LI-In-Bug.png" alt="linked-in icon" width="24"></a>
<a href="https://www.youtube.com/c/PlanetCassandra" target="_blank"><img src="../../../../../../../assets/img/youtube-icon.png" alt="youtube icon" width="24"></a>
</div>
</div>
<div class="col-2 flex flex-center">
<ul class="columns-2">
<li class="mb-small"><a href="/">Home</a></li>
<li class="mb-small"><a href="/_/cassandra-basics.html">Cassandra Basics</a></li>
<li class="mb-small"><a href="/_/quickstart.html">Quickstart</a></li>
<li class="mb-small"><a href="/_/ecosystem.html">Ecosystem</a></li>
<li class="mb-small"><a href="/doc/latest/">Documentation</a></li>
<li class="mb-small"><a href="/_/community.html">Community</a></li>
<li class="mb-small"><a href="/_/case-studies.html">Case Studies</a></li>
<li class="mb-small"><a href="/_/resources.html">Resources</a></li>
<li class="mb-small"><a href="/_/blog.html">Blog</a></li>
</ul>
</div>
</div>
</footer>
<div class="lower-footer bg-white pa-medium">
<div class="flex flex-row flex-vert-center">
<div class="pr-medium"><img src="../../../../../../../assets/img//feather-small.png" alt="ASF" width="20"></div>
<div class="pr-medium"><a href="http://www.apache.org/" target="_blank">Foundation</a></div>
<div class="pr-medium"><a href="https://www.apache.org/events/current-event.html" target="_blank">Events</a></div>
<div class="pr-medium"><a href="https://www.apache.org/licenses/" target="_blank">License</a></div>
<div class="pr-medium"><a href="https://www.apache.org/foundation/thanks" target="_blank">Thanks</a></div>
<div class="pr-medium"><a href="https://www.apache.org/security" target="_blank">Security</a></div>
<div class="pr-medium"><a href="https://privacy.apache.org/policies/privacy-policy-public.html" target="_blank">Privacy</a></div>
<div class="pr-medium"><a href="https://www.apache.org/foundation/sponsorship" target="_blank">Sponsorship</a></div>
</div>
<p class="my-medium">© 2009-<script>document.write(new Date().getFullYear())</script> <a href="https://apache.org" target="_blank">The Apache Software Foundation</a> under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation.</p>
</div>
<div id="fade" class="hidden"></div>
<div id="modal" class="hidden">
<div id="close-modal" class="cursor-pointer"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></div>
<div id="mod-content" class="vid-mod-content resp-container"></div>
</div>
<script src="../../../../../../../assets/js/site.js"></script>
<script async src="../../../../../../../assets/js/vendor/highlight.js"></script>
<script src="../../../../../../../assets/js/vendor/lunr.js"></script>
<script src="../../../../../../../assets/js/vendor/search.js" id="search-script" data-base-path="../../../../../../.." data-page-path="/Cassandra/5.0/cassandra/developing/cql/indexing/sai/sai-faq.html"></script>
<script async src="../../../../../../../assets/../search-index.js"></script>
<script>
jQuery(function(){
var windowW = $(window).width();
$(document)
.on('click','.mobile-nav-icon',function(){
$('.main-nav').fadeIn();
})
.on('click','.main-nav',function(){
if(windowW <= 1000){
$(this).fadeOut();
}
})
.on('click','#version-toggle',function(){
$(this).toggleClass('active');
$(this).next().fadeToggle();
})
.on('click','#mobile-docs-nav-burger', function(){
$(this).toggleClass('active');
$('.docs-nav').toggleClass('active');
});
var url = window.location.pathname;
var isQuickstart = url.includes('quickstart.html');
if(isQuickstart){
var footerCTA = document.getElementById('footer-cta');
footerCTA.innerHTML = 'Get latest updates';
footerCTA.setAttribute('href', '/_/blog.html');
}
});
</script>
</div>
</body>
</html>