<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Darren XU</title>
    <description>The latest articles on DEV Community by Darren XU (@darren_xu).</description>
    <link>https://dev.to/darren_xu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2824151%2Fd8382dbd-7674-48fa-9ffa-455e5bcf75ab.png</url>
      <title>DEV Community: Darren XU</title>
      <link>https://dev.to/darren_xu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darren_xu"/>
    <language>en</language>
    <item>
      <title>Best Practices for Syncing Hive Data to Apache Doris — From Scenario Matching to Performance Tuning</title>
      <dc:creator>Darren XU</dc:creator>
      <pubDate>Mon, 19 May 2025 08:31:41 +0000</pubDate>
      <link>https://dev.to/darren_xu/best-practices-for-syncing-hive-data-to-apache-doris-from-scenario-matching-to-performance-tuning-299m</link>
      <guid>https://dev.to/darren_xu/best-practices-for-syncing-hive-data-to-apache-doris-from-scenario-matching-to-performance-tuning-299m</guid>
      <description>&lt;p&gt;Hive to Apache Doris Data Synchronization: A Comprehensive Guide&lt;/p&gt;

&lt;p&gt;In the realm of big data, Hive has long been a cornerstone for massive data warehousing and offline processing, while Apache Doris shines in real-time analytics and ad-hoc query scenarios with its robust OLAP capabilities. When enterprises aim to combine Hive's storage prowess with Doris's analytical agility, the challenge lies in efficiently and reliably syncing data between these two systems. This article provides a comprehensive guide to Hive-to-Doris data synchronization, covering use cases, technical solutions, model design, and performance optimization.&lt;/p&gt;

&lt;p&gt;I. Core Use Cases and Scope&lt;/p&gt;

&lt;p&gt;When target data resides in a Hive data warehouse and requires accelerated analysis via Doris's OLAP capabilities, key scenarios include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reporting &amp;amp; Ad-Hoc Queries&lt;/strong&gt;: Enable fast analytics through synchronization or federated queries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unified Data Warehouse Construction&lt;/strong&gt;: Build layered data models in Doris to enhance query efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Federated Query Acceleration&lt;/strong&gt;: Directly access Hive tables from Doris to avoid frequent data ingestion.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;II. Technical Pathways and Synchronization Modes&lt;/p&gt;

&lt;h3&gt;
  
  
  (1) Synchronization Mode
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full/Incremental Sync&lt;/strong&gt;: Suitable for low-update-frequency scenarios (e.g., log data, dimension tables) where a complete data model is needed in Doris.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Federated Query Mode&lt;/strong&gt;: Ideal for high-frequency, small-data-volume scenarios (e.g., real-time pricing data) to reduce storage costs and ingestion latency by querying Hive directly from Doris.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  (2) Technical Solutions Overview
&lt;/h3&gt;

&lt;p&gt;Four mainstream approaches exist, chosen based on data volume, update frequency, and ETL complexity:&lt;/p&gt;

&lt;p&gt;III. In-Depth Analysis of Four Synchronization Solutions&lt;/p&gt;

&lt;h3&gt;
  
  
  (1) Broker Load: Asynchronous Sync for Large Dataset
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Core Principle&lt;/strong&gt;: Leverage Doris's built-in Broker service to asynchronously load data from HDFS (where Hive data resides) into Doris, supporting full and incremental modes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Suitable for datasets ranging from tens to hundreds of GB, stored in HDFS accessible by Doris.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Performance&lt;/strong&gt;: Syncing a 5.8GB SSB dataset (60M rows) takes 140–164 seconds, achieving 370k–420k rows/sec (cluster-dependent).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Key Operations&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Table Optimization&lt;/strong&gt;: Temporarily set &lt;code&gt;replication_num=1&lt;/code&gt; during ingestion for speed, then adjust to 3 replicas for durability.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Partition Conversion&lt;/strong&gt;: Convert Hive partition fields (e.g., &lt;code&gt;yyyymm&lt;/code&gt;) to Doris-compatible date types using &lt;code&gt;str_to_date&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;HA Configuration&lt;/strong&gt;: Include namenode addresses in &lt;code&gt;WITH BROKER&lt;/code&gt; for HDFS high-availability setups.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  (2) Doris On Hive: Low-Latency Federated Querie
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Core Principle&lt;/strong&gt;: Use a Catalog to access Hive metadata, enabling direct queries or &lt;code&gt;INSERT INTO SELECT&lt;/code&gt; syncs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Small datasets (e.g., pricing tables) with frequent updates (minute-level), no pre-aggregation needed in Doris.&lt;/li&gt;
&lt;li&gt;  Supports Text, Parquet, ORC formats (Hive ≥2.3.7).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  No data landing in Doris; direct join queries between Hive and Doris tables with sub-0.2-second latency.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  (3) Spark Load: Performance Acceleration for Complex ETL
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Core Principle&lt;/strong&gt;: Offload data preprocessing to an external Spark cluster, reducing Doris's computational pressure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Complex data cleaning (e.g., multi-table JOINs, field transformations) with Spark accessing HDFS.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Performance&lt;/strong&gt;: 5.8GB synced in 137 seconds (440k rows/sec), outperforming Broker Load.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Configuration&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Spark Settings&lt;/strong&gt;: Update Doris FE config (&lt;code&gt;fe.conf&lt;/code&gt;) with &lt;code&gt;spark_home&lt;/code&gt; and &lt;code&gt;spark_resource_path&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

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

spark_home_default_dir = /opt/cloudera/parcels/CDH/lib/spark 

spark_resource_path = /opt/cloudera/parcels/CDH/lib/spark/spark-2x.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;External Resource Creation&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE EXTERNAL RESOURCE "spark0"
PROPERTIES
(
"type" = "spark",
"spark.master" = "yarn",
"spark.submit.deployMode" = "cluster",
"spark.executor.memory" = "1g",
"spark.yarn.queue" = "queue0",
"spark.hadoop.yarn.resourcemanager.address" = "hdfs://nodename:8032",
"spark.hadoop.fs.defaultFS" = "hdfs://nodename:8020",
"working_dir" = "hdfs://nodename:8020/tmp/doris",
"broker" = "broker_name_1"
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  (4) DataX: Heterogeneous Data Source Compatibility
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Core Principle&lt;/strong&gt;: Use Alibaba's open-source DataX tool with custom &lt;code&gt;hdfsreader&lt;/code&gt; and &lt;code&gt;doriswriter&lt;/code&gt; plugins.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Non-standard file formats (e.g., CSV) or non-HA HDFS environments.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Drawback&lt;/strong&gt;: Lower performance (5.8GB in 1,421 seconds, 40k rows/sec) – use as a fallback.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configuration Example&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

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

 "job": { 

   "content": [ 

     { 

       "reader": { 

         "name": "hdfsreader", 

         "parameter": { 

           "path": "/data/ssb/*", 

           "defaultFS": "hdfs://xxxx:9000", 

           "fileType": "text" 
         } 

       }, 

       "writer": { 

         "name": "doriswriter", 

         "parameter": { 

           "feLoadUrl": ["xxxx:18040"], 

           "database": "test", 

           "table": "lineorder3" 

         } 

       } 

     } 

   ] 

 } 

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

&lt;/div&gt;



&lt;p&gt;IV. Decision Tree for Solution Selection&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Priority&lt;/strong&gt;: Broker Load – Large datasets (≥10GB), minimal ETL, high throughput needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Second Choice&lt;/strong&gt;: Doris On Hive – Small datasets (&amp;lt;1GB), frequent updates, federated query requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Complex ETL&lt;/strong&gt;: Spark Load – Data preprocessing needed; leverage Spark cluster resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fallback&lt;/strong&gt;: DataX – Special formats or network constraints; prioritize compatibility over performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;V. Data Modeling and Storage Optimization&lt;/p&gt;

&lt;h3&gt;
  
  
  (1) Data Model Selection
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Aggregate Model&lt;/strong&gt;: Ideal for log statistics; stores aggregated metrics by key to reduce data volume.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unique Model&lt;/strong&gt;: Ensures key uniqueness for slowly changing dimensions (equivalent to &lt;code&gt;Replace&lt;/code&gt; in Aggregate).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Duplicate Model&lt;/strong&gt;: Stores raw data for multi-dimensional analysis without aggregation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  (2) Data Type Mapping
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;String to Varchar&lt;/strong&gt;: Use Varchar for Doris key columns (avoid String); reserve 3x Hive field length for Chinese characters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type Consistency&lt;/strong&gt;: Convert Hive dates to Doris &lt;code&gt;Date/DateTime&lt;/code&gt; and numeric types to &lt;code&gt;Decimal/Float&lt;/code&gt; to avoid query-time conversions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  (3) Partitioning &amp;amp; Bucketing Strategie
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Partition Keys&lt;/strong&gt;: Reuse Hive partition fields (e.g., year-month) converted via &lt;code&gt;str_to_date&lt;/code&gt; for pruning.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bucket Keys&lt;/strong&gt;: Choose high-cardinality fields (e.g., order ID); keep single bucket size under 10GB to avoid skew and segment limits (default ≤200).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VI. Performance Comparison and Best Practices&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;th&gt;5.8GB Sync Time&lt;/th&gt;
&lt;th&gt;Throughput&lt;/th&gt;
&lt;th&gt;Query Latency&lt;/th&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Broker Load&lt;/td&gt;
&lt;td&gt;140–164&lt;/td&gt;
&lt;td&gt;370k–420k rows/&lt;/td&gt;
&lt;td&gt;0.2–0.5&lt;/td&gt;
&lt;td&gt;Large-scale full sync&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spark Load&lt;/td&gt;
&lt;td&gt;137&lt;/td&gt;
&lt;td&gt;440k rows/&lt;/td&gt;
&lt;td&gt;0.3&lt;/td&gt;
&lt;td&gt;ETL-intensive sync&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Doris On Hive&lt;/td&gt;
&lt;td&gt;Immediate&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;0.2–0.4&lt;/td&gt;
&lt;td&gt;High-frequency federated querie&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DataX&lt;/td&gt;
&lt;td&gt;1,421&lt;/td&gt;
&lt;td&gt;40k rows/&lt;/td&gt;
&lt;td&gt;1–3&lt;/td&gt;
&lt;td&gt;Special format compatibility&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Optimization Tips:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Small File Merging&lt;/strong&gt;: Use HDFS commands to merge small files and reduce Broker Load scanning.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Model Tuning&lt;/strong&gt;: Use Duplicate model for fast ingestion, then create materialized views for query speed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Monitoring&lt;/strong&gt;: Track load status with &lt;code&gt;SHOW LOAD&lt;/code&gt; in Doris.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VII. Conclusion&lt;/p&gt;

&lt;p&gt;Combining Hive and Doris unlocks synergies between offline storage and real-time analytics. By choosing the right sync strategy (prioritizing Broker/Spark Load), optimizing data models (Aggregate for storage, bucketing for skew), and leveraging federated queries (Doris On Hive), enterprises can build efficient data architectures. Test with small datasets (e.g., SSB) before scaling to production, and stay updated with Doris community improvements (e.g., predicate pushdown) for ongoing performance gains.&lt;/p&gt;

&lt;p&gt;if want to get more information and help of doris, you can join us&lt;/p&gt;

&lt;p&gt;&lt;a href="https://join.slack.com/t/apachedoriscommunity/shared_invite/zt-31dcopb90-zqBVqBrOIYhmy4U29fv9yQ" rel="noopener noreferrer"&gt;https://join.slack.com/t/apachedoriscommunity/shared_invite/zt-31dcopb90-zqBVqBrOIYhmy4U29fv9yQ&lt;/a&gt;&lt;/p&gt;

</description>
      <category>doris</category>
      <category>database</category>
      <category>bigdata</category>
    </item>
    <item>
      <title>Doris: Breaking Down the Barriers of SQL Dialects and Building a Unified Data Query Ecosystem</title>
      <dc:creator>Darren XU</dc:creator>
      <pubDate>Tue, 15 Apr 2025 08:51:52 +0000</pubDate>
      <link>https://dev.to/darren_xu/doris-breaking-down-the-barriers-of-sql-dialects-and-building-a-unified-data-query-ecosystem-37k1</link>
      <guid>https://dev.to/darren_xu/doris-breaking-down-the-barriers-of-sql-dialects-and-building-a-unified-data-query-ecosystem-37k1</guid>
      <description>&lt;p&gt;In the realm of big data, different database systems frequently employ distinct SQL dialects. This is analogous to people from various regions speaking different languages, posing substantial challenges to data analysts and developers. When enterprises need to integrate multiple data sources for analysis, they often have to invest a great deal of time and effort in switching between different SQL syntaxes. However, Apache Doris, with its robust SQL dialect compatibility capabilities, has shattered this barrier and constructed a unified data query ecosystem for users.&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%2F3x0y98w9qgirrfqen3yn.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%2F3x0y98w9qgirrfqen3yn.png" alt="Image description" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL Dialect Compatibility: The "Universal Language" in a Complex Data Environment
&lt;/h2&gt;

&lt;p&gt;In today's enterprise data architectures, it is a common occurrence for data to be dispersed across multiple database systems. These database systems each have their own characteristics. For instance, MySQL is commonly utilized for online transaction processing (OLTP), excelling in high - concurrency writing and transaction handling. Hive, on the other hand, is a leading force in big data offline analysis, capable of processing vast amounts of data. The use of different SQL dialects by these diverse database systems makes it extremely difficult for data analysts and developers to query and integrate data across systems.&lt;/p&gt;

&lt;p&gt;The SQL dialect compatibility feature of Apache Doris is like a master interpreter, enabling users to communicate freely between different database systems. Doris not only supports standard SQL syntax but also is compatible with the SQL dialects of multiple mainstream databases, significantly reducing the learning and usage costs. Users no longer need to worry about the syntax differences among different database systems and can effortlessly query and analyze data from multiple data sources through Doris.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Doris Achieves SQL Dialect Compatibility
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The "Intelligent Collaboration" of the Parser and Optimizer
&lt;/h3&gt;

&lt;p&gt;Doris realizes support for multiple SQL dialects through its unique parser and optimizer design. When a user submits an SQL query, the parser first conducts lexical and syntactic analysis on the query statement, transforming it into an abstract syntax tree (AST). During this process, the parser can identify the syntax structures of different dialects and handle them appropriately.&lt;/p&gt;

&lt;p&gt;Subsequently, the optimizer optimizes the abstract syntax tree. It generates an efficient execution plan based on the query semantics and data distribution. In this process, the optimizer fully takes into account the characteristics of different data sources and selects the optimal query strategy, ensuring that the query can be executed efficiently on different data sources.&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%2Frqhepfxb52f2ua5zvzzh.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%2Frqhepfxb52f2ua5zvzzh.png" alt="Image description" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The "Seamless Connection" of Metadata Management
&lt;/h3&gt;

&lt;p&gt;To achieve unified querying of different data sources, Doris has established a comprehensive metadata management mechanism. It can automatically discover and synchronize the metadata information of multiple data sources, including table structures, field types, indexes, etc. In this way, when users query data in Doris, it is as convenient as querying local tables, and they do not need to be concerned about the actual storage location of the data.&lt;/p&gt;

&lt;p&gt;Moreover, Doris's metadata management mechanism also supports real - time updates, ensuring that users can always obtain the latest data source information. This provides great convenience for users, enabling them to respond promptly to business changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Analysis of Practical Application Scenarios
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Replacing the Original OLAP System with Doris
&lt;/h3&gt;

&lt;p&gt;For example, if the original systems are Trino and ClickHouse, and the switch is made to Doris. There are a large number of existing SQL business logics in the upstream business. If the business side is required to change the SQL dialect, the cost will be extremely high. The business hopes to be able to use the original SQL dialect to query in Doris.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Unified SQL Entrance
&lt;/h3&gt;

&lt;p&gt;Doris serves as a unified entrance for OLAP. Users may query Hive tables through Doris and hope to use the SQL dialects of Hive or Spark.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Query Degradation
&lt;/h3&gt;

&lt;p&gt;Users use Doris as a high - speed query engine. However, if some queries are not supported or fail (such as due to insufficient memory), the SQL needs to be downgraded and routed to, for example, a Spark cluster for execution. In such cases, users hope to uniformly use the Spark dialect, first send it to Doris, and if it fails, directly send it to Spark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of Achieving SQL Dialect Compatibility with Doris
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Reducing the Technical Threshold
&lt;/h3&gt;

&lt;p&gt;For data analysts and developers, the SQL dialect compatibility feature of Doris reduces the learning and usage costs. They do not need to spend a significant amount of time learning the SQL syntaxes of different database systems and can easily query and analyze data from multiple data sources through Doris. This allows them to focus more on business analysis and improve work efficiency.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Improving Data Integration Efficiency
&lt;/h3&gt;

&lt;p&gt;Doris breaks down the barriers between different database systems, enabling rapid data integration and analysis. Enterprises can establish a unified data query platform through Doris, allowing personnel from different departments to easily obtain the required data, promoting data sharing and utilization, and providing strong support for enterprise decision - making.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Ensuring Business Continuity
&lt;/h3&gt;

&lt;p&gt;In the process of continuous evolution of enterprise data architectures, the SQL dialect compatibility feature of Doris provides assurance for business continuity. Even if enterprises replace or add new data sources, Doris can still seamlessly connect, ensuring that data querying and analysis are not affected.&lt;/p&gt;

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

&lt;p&gt;The SQL dialect compatibility feature of Apache Doris offers an efficient and convenient data query solution for enterprises in a complex data environment. It breaks down the barriers of SQL dialects, allowing data to flow freely and injecting powerful impetus into the digital transformation of enterprises. It is believed that in the future, with the continuous development and improvement of Doris, it will play an even more important role in more fields and help enterprises maximize the value of data.&lt;/p&gt;

&lt;p&gt;If you are interested in the [SQL dialect](&lt;a href="https://doris.apache.org/zh" rel="noopener noreferrer"&gt;https://doris.apache.org/zh&lt;/a&gt; - CN/docs/lakehouse/sql - dialect) compatibility feature of Doris, you might as well give it a try and experience the convenience and efficiency it brings!&lt;/p&gt;

</description>
      <category>sql</category>
      <category>doris</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Is Storage-Computing Separation Really Necessary? From the Architectural Debate to the Practical Analysis of Doris</title>
      <dc:creator>Darren XU</dc:creator>
      <pubDate>Mon, 31 Mar 2025 10:00:39 +0000</pubDate>
      <link>https://dev.to/darren_xu/is-storage-computing-separation-really-necessary-from-the-architectural-debate-to-the-practical-j4i</link>
      <guid>https://dev.to/darren_xu/is-storage-computing-separation-really-necessary-from-the-architectural-debate-to-the-practical-j4i</guid>
      <description>&lt;h1&gt;
  
  
  Introduction: A Decade-Long Debate on “Storage and Computing”
&lt;/h1&gt;

&lt;p&gt;In the field of databases and big data, the architectural debate between “storage-computing integration” and “storage-computing separation” has never ceased. Some people question, “Is storage-computing separation really necessary? Isn’t the performance of local disks sufficient?” The answer is not black and white — the key to technology selection lies in the precise matching of business scenarios and resource requirements. This article takes Apache Doris as an example to analyze the essential differences, advantages and disadvantages, and implementation scenarios of the two architectures.&lt;/p&gt;

&lt;h2&gt;
  
  
  I. Storage-Computing Integration vs. Storage-Computing Separation: Core Concepts and Evolution Logic
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.Storage-Computing Integration: The Tightly-Coupled “All-Rounder”
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;: Data storage and computing resources are bound to the same node (such as a local disk + server), and local reading and writing are used to reduce network overhead. Typical examples include the early architecture of Hadoop and traditional OLTP databases.&lt;br&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%2Fjaiydk173j7otzwckad3.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%2Fjaiydk173j7otzwckad3.png" alt="Image description" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Historical Origin&lt;/strong&gt;: In the early days of IT systems, the data volume was small (such as IBM mainframes in the 1960s), and a single machine could meet the storage and computing requirements, naturally forming a storage-computing integration architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.Storage-Computing Separation: The Decoupled “Perfect Partners”
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;: The storage layer (such as object storage, HDFS) and the computing layer (such as cloud servers, container clusters) are independently scalable and connected through a high-speed network to achieve data sharing. Typical representatives include the cloud-native database Snowflake and the storage-computing separation mode of Doris.&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%2Fennvs37xroek9hcw9iav.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%2Fennvs37xroek9hcw9iav.png" alt="Image description" width="800" height="843"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Driving Forces&lt;/strong&gt;: Exponential growth of data volume, elastic requirements of cloud computing, and fine-grained cost control.&lt;/p&gt;

&lt;h2&gt;
  
  
  II. Architectural Duel: The Ultimate Game of Performance, Cost, and Elasticity
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.Advantages and Shortcomings of Storage-Computing Integration
&lt;/h3&gt;

&lt;h4&gt;
  
  
  (1)Advantages
&lt;/h4&gt;

&lt;p&gt;Minimal Deployment: It does not need to rely on external storage systems and can run on a single machine, which is suitable for quick trials or small to medium — scale scenarios (for example, the storage-computing integration mode of Doris only requires the deployment of FE/BE processes).&lt;/p&gt;

&lt;p&gt;Ultimate Performance: Local reading and writing reduce network latency, making it suitable for high — concurrency and low — latency scenarios. (For example, in the YCSB scenario, the storage-computing integration of Doris can reach 30,000 QPS, and the 99th percentile latency is as low as 0.6ms)&lt;/p&gt;

&lt;h4&gt;
  
  
  (2)Shortcomings
&lt;/h4&gt;

&lt;p&gt;Inflexible Expansion: Storage and computing need to be scaled simultaneously, which is likely to cause resource waste (for example, the CPU is idle while the disk is full).&lt;/p&gt;

&lt;p&gt;High Cost: The price of local SSD disks is high, and redundant backups increase hardware investment (for example, the storage-computing integration version of Doris requires three copies to ensure high data reliability).&lt;/p&gt;

&lt;h3&gt;
  
  
  2.Breakthroughs and Challenges of Storage-Computing Separation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  (1)Advantages
&lt;/h4&gt;

&lt;p&gt;Elastic Scalability: Computing resources can be scaled on demand, and storage can be independently expanded (for example, the computing group of Doris can dynamically add or remove nodes).&lt;/p&gt;

&lt;p&gt;Cost Optimization: Shared storage (such as object storage) costs as low as 1/3 of that of local disks and supports hierarchical management of hot and cold data.&lt;/p&gt;

&lt;p&gt;High Availability: The storage layer has independent disaster recovery, and there is no risk of data loss in case of computing node failures.&lt;/p&gt;

&lt;h4&gt;
  
  
  (2)Challenges
&lt;/h4&gt;

&lt;p&gt;Network Bottleneck: Remote reading and writing may introduce latency (relying on intelligent caching optimization).&lt;/p&gt;

&lt;p&gt;Operation and Maintenance Complexity: It is necessary to manage shared storage (such as HDFS, S3) and network stability.&lt;/p&gt;

&lt;h2&gt;
  
  
  III. Scenarios Matter: How to Choose the Most Suitable Architecture?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.The “Main Battlefield” of Storage-Computing Integration
&lt;/h3&gt;

&lt;p&gt;Small to Medium-Scale Real-Time Analysis: The data volume is within the TB level, and low latency is pursued (such as the high-concurrency query scenario of Doris).&lt;/p&gt;

&lt;p&gt;Independent Business Lines: There is no dedicated DBA team, and simple operation and maintenance are required (such as start-ups trying out data analysis).&lt;/p&gt;

&lt;p&gt;No Dependence on Cloud Environment: Localized deployment and no reliable shared storage resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.The “Killer Scenarios” of Storage-Computing Separation
&lt;/h3&gt;

&lt;p&gt;Cloud Native and Elastic Requirements: In public cloud / hybrid cloud environments, pay — as — you — go is required (for example, the cloud-native version of Doris supports K8s containerization).&lt;/p&gt;

&lt;p&gt;Massive Data Lake Warehouses: PB — level data storage, and multiple computing clusters share the same data source (such as financial risk control, e-commerce user portraits).&lt;/p&gt;

&lt;p&gt;Cost-Sensitive Businesses: Archiving historical data, low-cost storage of cold data (such as the hot and cold layering technology of Doris).&lt;/p&gt;

&lt;h2&gt;
  
  
  IV. Practical Insights from Doris: Can You Have Your Cake and Eat It Too?
&lt;/h2&gt;

&lt;p&gt;As a new-generation real-time analysis database, Apache Doris supports both storage-computing integration and storage-computing separation modes, becoming a benchmark for architectural flexibility:&lt;/p&gt;

&lt;h3&gt;
  
  
  1.Storage-Computing Integration Mode
&lt;/h3&gt;

&lt;p&gt;Applicable Scenarios: Development and testing, small to medium-scale real-time analysis.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.Storage-Computing Separation Mode
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Technical Highlights
&lt;/h4&gt;

&lt;p&gt;Shared Storage: Supports HDFS/S3, decoupling the main data storage from computing nodes.&lt;/p&gt;

&lt;p&gt;Local Cache: BE nodes cache hot data to offset network latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Doris case&lt;/strong&gt;: Slash your cost by 90% with Apache Doris Compute-Storage Decoupled Mode&lt;/p&gt;

&lt;h2&gt;
  
  
  V. Conclusion: There Is No Absolutely Optimal, Only the Most Suitable Match
&lt;/h2&gt;

&lt;p&gt;Storage-computing separation is not a “panacea”, and storage-computing integration is not an “outdated product”. Technical decisions should return to the essence of the business:&lt;/p&gt;

&lt;p&gt;Choose Storage-Computing Integration: When performance is sensitive, the data scale is controllable, and operation and maintenance resources are limited.&lt;/p&gt;

&lt;p&gt;Embrace Storage-Computing Separation: When cost and elasticity are the core requirements and a cloud-native technology stack is available.&lt;/p&gt;

&lt;p&gt;In the future, with the breakthroughs in storage networks (such as RDMA) and intelligent caching technologies, the “performance ceiling” of storage-computing separation will be further broken. The continuous evolution of open-source technologies such as Doris is providing more possibilities for this architectural debate.&lt;/p&gt;

</description>
      <category>doris</category>
      <category>bigdata</category>
    </item>
    <item>
      <title>A Deep Dive into Apache Doris Indexes</title>
      <dc:creator>Darren XU</dc:creator>
      <pubDate>Mon, 31 Mar 2025 09:48:05 +0000</pubDate>
      <link>https://dev.to/darren_xu/a-deep-dive-into-apache-doris-indexes-3fi8</link>
      <guid>https://dev.to/darren_xu/a-deep-dive-into-apache-doris-indexes-3fi8</guid>
      <description>&lt;h1&gt;
  
  
  A Deep Dive into Apache Doris Indexes
&lt;/h1&gt;

&lt;p&gt;Developers in the big data field know that quickly retrieving data from a vast amount of information is like searching for a specific star in the constellations—extremely challenging. But don't worry! Database indexes are our “positioning magic tools,” capable of significantly boosting query efficiency.&lt;/p&gt;

&lt;p&gt;Take Apache Doris, a popular analytical database, for example. It supports several types of indexes, each with its own unique features, enabling it to excel in various query scenarios. Today, let's explore Apache Doris indexes in detail and uncover the secrets behind their remarkable performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  I. Classification and Principles of Indexes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  (A) Point Query Indexes: Precise Targeting of Data Points
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Prefix Indexes: Shortcuts on Sorted Keys
&lt;/h4&gt;

&lt;p&gt;Apache Doris stores data in an ordered structure similar to SSTable, sorted by specified columns. For the three data models—Aggregate, Unique, and Duplicate—when creating a table, they are sorted based on the Aggregate Key, Unique Key, and Duplicate Key specified in the table creation statements.&lt;/p&gt;

&lt;p&gt;These sorted keys are like the category labels on a well - organized bookshelf. Prefix indexes, on the other hand, are sparse indexes built on these sorted keys.&lt;/p&gt;

&lt;p&gt;Imagine that every 1,024 rows of data form a logical data block, similar to a partition on a bookshelf. Each partition has an index entry in the prefix index table. This index entry serves as a “mini - directory” for the partition, with its content being the prefix formed by the sorted columns of the first row in the partition.&lt;/p&gt;

&lt;p&gt;When queries involve these sorted columns, the system can quickly locate the relevant data block through this compact “directory,” much like finding the required book category through the partition directory on a bookshelf. This significantly reduces the search range and accelerates queries.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note ⚠️ The length of Doris prefix indexes does not exceed 36 bytes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, if the sorted columns of a table are &lt;code&gt;user_id&lt;/code&gt; (8 Bytes), &lt;code&gt;age&lt;/code&gt; (4 Bytes), &lt;code&gt;message&lt;/code&gt; (VARCHAR (100)), the prefix index might consist of &lt;code&gt;user_id&lt;/code&gt; + &lt;code&gt;age&lt;/code&gt; + the first 20 bytes of &lt;code&gt;message&lt;/code&gt; (if the total length does not exceed 36 bytes).&lt;/p&gt;

&lt;p&gt;When the query condition is &lt;code&gt;SELECT * FROM table WHERE user_id = 1829239 and age = 20;&lt;/code&gt;, the prefix index can quickly locate the logical data block containing the matching data. The query efficiency is much higher than &lt;code&gt;SELECT * FROM table WHERE age = 20;&lt;/code&gt; because the latter cannot effectively utilize the prefix index.&lt;/p&gt;

&lt;h4&gt;
  
  
  Inverted Indexes: Keyword Locators for Information Retrieval
&lt;/h4&gt;

&lt;p&gt;Since version 2.0.0, Doris has introduced inverted indexes, a powerful tool that plays a crucial role in the field of information retrieval. In the world of Doris, a row in a table is like a document, and a column is a field within the document.&lt;/p&gt;

&lt;p&gt;Inverted indexes are like highly efficient “keyword locators,” breaking down text into individual words and constructing an index from words to document numbers (i.e., rows in the table).&lt;/p&gt;

&lt;p&gt;For example, for a table containing user comments, after creating an inverted index on the comment column, when we want to query comments containing a specific keyword (such as “OLAP”), the inverted index can quickly locate the rows containing the keyword.&lt;/p&gt;

&lt;p&gt;It not only accelerates full - text retrieval for string types, supporting various keyword matching methods like matching multiple keywords simultaneously (MATCH_ALL), matching any one of the keywords (MATCH_ANY), and phrase queries (MATCH_PHRASE), but also accelerates ordinary equality and range queries, replacing the previous BITMAP index function.&lt;/p&gt;

&lt;p&gt;In terms of storage, inverted indexes use independent files, physically separated from data files. This allows indexes to be created and deleted without rewriting data files, greatly reducing processing overhead.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note ⚠️ Floating - point types with precision issues (FLOAT and DOUBLE) and some complex data types (such as MAP, STRUCT, etc.) do not currently support inverted indexes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  (B) Skip - Indexes: Smartly Skipping “Irrelevant Data Blocks”
&lt;/h3&gt;

&lt;h4&gt;
  
  
  ZoneMap Indexes: Statistical Detectives for Data Blocks
&lt;/h4&gt;

&lt;p&gt;ZoneMap indexes are like silent “statistical detectives,” automatically maintaining statistical information for each column. For each data file (Segment) and data block (Page), they record the maximum value, minimum value, and whether there are NULL values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When performing equality queries, range queries, or IS NULL queries&lt;/strong&gt;, they can quickly determine whether the data file or data block is likely to contain data that meets the conditions based on this statistical information. If it is determined not to contain such data, just like a detective eliminating an irrelevant clue, the file or data block is skipped without being read, reducing I/O operations and accelerating queries.&lt;/p&gt;

&lt;p&gt;For example, in a table containing user ages, when querying data within a certain age range, the ZoneMap index can quickly exclude data blocks that clearly do not meet the conditions based on the maximum and minimum ages of the data blocks, improving query efficiency.&lt;/p&gt;

&lt;h4&gt;
  
  
  BloomFilter Indexes: Probabilistic Fast Sieves
&lt;/h4&gt;

&lt;p&gt;BloomFilter indexes are skip - indexes based on the BloomFilter algorithm, acting like highly efficient “fast sieves.” BloomFilter is a space - efficient probabilistic data structure consisting of an extremely long binary array and a series of hash functions.&lt;/p&gt;

&lt;p&gt;In Doris, BloomFilter indexes are constructed on a per - data - block (page) basis. When writing data, each value in the data block is hashed and stored in the corresponding BloomFilter. During queries, based on the value of the equality condition, it is determined whether the BloomFilter contains the value. If not, the corresponding data block is skipped.&lt;/p&gt;

&lt;p&gt;For example, in a table containing a large number of user IDs, after creating a BloomFilter index on the user ID column, when querying for a specific user ID, if the BloomFilter determines that the user ID is not in the BloomFilter corresponding to a certain data block, the data block can be skipped without being read, greatly reducing I/O.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note ⚠️ It is only effective for IN and = equality queries. It does not support Tinyint, Float, or Double type columns, and has limited acceleration effects for low - cardinality fields.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  NGram BloomFilter Indexes: Boosters for Text LIKE Queries
&lt;/h4&gt;

&lt;p&gt;NGram BloomFilter indexes are specifically designed for text LIKE queries, serving as “boosters” for text queries. They are similar to BloomFilter indexes, but instead of storing the original text values in the BloomFilter, each word obtained by NGram tokenization of the text is stored.&lt;/p&gt;

&lt;p&gt;For LIKE queries, the LIKE pattern is also tokenized using NGram, and it is determined whether each word is in the BloomFilter. If a word is not present, the corresponding data block does not meet the LIKE condition, and the data block can be skipped.&lt;/p&gt;

&lt;p&gt;For example, in a table storing product descriptions, after creating an NGram BloomFilter index on the description column, when querying for product descriptions containing a specific phrase (such as “super awesome”), it can quickly filter out data blocks that may contain the phrase, accelerating the query.&lt;/p&gt;

&lt;p&gt;However, it only supports string columns and requires the number of consecutive characters in the LIKE pattern to be greater than or equal to N in the NGram defined in the index.&lt;/p&gt;

&lt;h2&gt;
  
  
  II. Detailed Comparison of Index Characteristics
&lt;/h2&gt;

&lt;p&gt;Different types of indexes have their own advantages and limitations. Let's compare them intuitively through the following table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Index&lt;/th&gt;
&lt;th&gt;Advantages&lt;/th&gt;
&lt;th&gt;Limitations&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Point Query Indexes&lt;/td&gt;
&lt;td&gt;Prefix Indexes&lt;/td&gt;
&lt;td&gt;Built - in index, best performance&lt;/td&gt;
&lt;td&gt;Only one set of prefix indexes per table&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Point Query Indexes&lt;/td&gt;
&lt;td&gt;Inverted Indexes&lt;/td&gt;
&lt;td&gt;Supports tokenization and keyword matching, indexes can be created on any column, supports multi - condition combinations, and continuously adds function acceleration&lt;/td&gt;
&lt;td&gt;Large index storage space, approximately equivalent to the original data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skip - Indexes&lt;/td&gt;
&lt;td&gt;ZoneMap Indexes&lt;/td&gt;
&lt;td&gt;Built - in index, small index storage space&lt;/td&gt;
&lt;td&gt;Limited supported query types, only supports equality and range queries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skip - Indexes&lt;/td&gt;
&lt;td&gt;BloomFilter Indexes&lt;/td&gt;
&lt;td&gt;More refined than ZoneMap, moderate index space&lt;/td&gt;
&lt;td&gt;Limited supported query types, only supports equality queries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skip - Indexes&lt;/td&gt;
&lt;td&gt;NGram BloomFilter Indexes&lt;/td&gt;
&lt;td&gt;Supports LIKE acceleration, moderate index space&lt;/td&gt;
&lt;td&gt;Limited supported query types, only supports LIKE acceleration&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  III. List of Operators and Functions Accelerated by Indexes
&lt;/h2&gt;

&lt;p&gt;Understanding the support of indexes for different operators and functions helps us better utilize indexes to accelerate queries:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operators / Functions&lt;/th&gt;
&lt;th&gt;Prefix Indexes&lt;/th&gt;
&lt;th&gt;Inverted Indexes&lt;/th&gt;
&lt;th&gt;ZoneMap Indexes&lt;/th&gt;
&lt;th&gt;BloomFilter Indexes&lt;/th&gt;
&lt;th&gt;NGram BloomFilter Indexes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!=&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IN&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NOT IN&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;, &amp;gt;=, &amp;lt;, &amp;lt;=, BETWEEN&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IS NULL&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IS NOT NULL&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LIKE&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MATCH, MATCH_*&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;array_contains&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;array_overlaps&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;is_ip_address_in_range&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;td&gt;NO&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  IV. Guide to Index Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  (A) Suggestions for Selecting Prefix Indexes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Select the Most Frequently Filtered Fields
&lt;/h4&gt;

&lt;p&gt;Since there is only one set of prefix indexes per table, it is advisable to use the fields most frequently used in WHERE filtering conditions as the Key.&lt;/p&gt;

&lt;p&gt;For example, in a user behavior analysis table, if queries are often made based on user IDs, it is a wise choice to use user ID as the Key column of the prefix index.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Order of Fields Matters
&lt;/h4&gt;

&lt;p&gt;The more frequently used fields should be placed at the front. Prefix indexes are only effective when the fields in the WHERE condition are in the prefix of the Key.&lt;/p&gt;

&lt;p&gt;For instance, if the query condition is often &lt;code&gt;WHERE user_id = 123 AND age = 25&lt;/code&gt;, it is better to place &lt;code&gt;user_id&lt;/code&gt; before &lt;code&gt;age&lt;/code&gt; as the sorted columns when creating the table to make better use of the prefix index for query acceleration.&lt;/p&gt;

&lt;h3&gt;
  
  
  (B) Suggestions for Selecting Other Indexes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Filtering of Non - Key Fields
&lt;/h4&gt;

&lt;p&gt;For non - Key fields that require filtering acceleration, it is advisable to create inverted indexes first because of their wide applicability and support for multi - condition combinations.&lt;/p&gt;

&lt;p&gt;For example, in a table containing user comments and ratings, if queries need to be filtered based on both comment content and rating range, an inverted index can meet the requirements effectively.&lt;/p&gt;

&lt;h4&gt;
  
  
  String LIKE Matching
&lt;/h4&gt;

&lt;p&gt;If there is a need for string LIKE matching, an NGram BloomFilter index can be added. For example, in a product description search scenario, using an NGram BloomFilter index can effectively accelerate LIKE queries.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sensitivity to Index Storage Space
&lt;/h4&gt;

&lt;p&gt;When sensitivity to index storage space is high, inverted indexes can be replaced with BloomFilter indexes.&lt;/p&gt;

&lt;p&gt;For example, in a table storing a massive amount of low - cardinality user attribute data, BloomFilter indexes can reduce storage space while meeting the acceleration requirements for equality queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  (C) Performance Optimization and Analysis
&lt;/h3&gt;

&lt;p&gt;If the performance does not meet expectations, analyze the amount of data filtered by indexes and the time consumed through QueryProfile. Refer to the detailed documentation of each index for specific analysis.&lt;/p&gt;

&lt;p&gt;For example, evaluate the filtering effect of indexes by checking indicators such as &lt;code&gt;RowsKeyRangeFiltered&lt;/code&gt; (the number of rows filtered by prefix indexes) and &lt;code&gt;RowsInvertedIndexFiltered&lt;/code&gt; (the number of rows filtered by inverted indexes), and then optimize the index design.&lt;/p&gt;

&lt;h2&gt;
  
  
  V. Management and Usage of Indexes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  (A) Prefix Indexes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Management
&lt;/h4&gt;

&lt;p&gt;Prefix indexes do not require a specific syntax for definition. When creating a table, the first 36 bytes of the table's Key are automatically taken as the prefix index.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;p&gt;They are used to accelerate equality and range queries in WHERE conditions. They take effect automatically when applicable, with no special syntax required.&lt;/p&gt;

&lt;p&gt;For example, in a query like &lt;code&gt;SELECT * FROM table WHERE user_id = 123 AND age &amp;gt; 20;&lt;/code&gt;, if &lt;code&gt;user_id&lt;/code&gt; and &lt;code&gt;age&lt;/code&gt; are sorted columns, the prefix index will automatically play its role.&lt;/p&gt;

&lt;h3&gt;
  
  
  (B) Inverted Indexes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Management
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Definition at Table Creation&lt;/strong&gt;: In the table creation statement, define the index after the COLUMN definition. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE table_name (

   column_name1 TYPE1,

   column_name2 TYPE2,

   INDEX idx_name1(column_name1) USING INVERTED [PROPERTIES(...)] [COMMENT 'your comment']

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

&lt;/div&gt;



&lt;p&gt;Specify the index column name, index type (USING INVERTED), and additional attributes such as tokenizers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding to Existing Tables&lt;/strong&gt;: Both &lt;code&gt;CREATE INDEX&lt;/code&gt; and &lt;code&gt;ALTER TABLE ADD INDEX&lt;/code&gt; syntaxes are supported. After adding a new index definition, new data written will generate inverted indexes. For existing data, use &lt;code&gt;BUILD INDEX&lt;/code&gt; to trigger index construction. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE INDEX idx_name ON table_name(column_name) USING INVERTED;

BUILD INDEX index_name ON table_name;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Deleting from Existing Tables&lt;/strong&gt;: Use &lt;code&gt;DROP INDEX idx_name ON table_name;&lt;/code&gt; or &lt;code&gt;ALTER TABLE table_name DROP INDEX idx_name;&lt;/code&gt; to delete inverted indexes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Full - Text Retrieval Keyword Matching&lt;/strong&gt;: Achieved through &lt;code&gt;MATCH_ANY&lt;/code&gt;, &lt;code&gt;MATCH_ALL&lt;/code&gt;, etc. For example, &lt;code&gt;SELECT * FROM table_name WHERE column_name MATCH_ANY 'keyword1 ...';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full - Text Retrieval Phrase Matching&lt;/strong&gt;: Achieved through &lt;code&gt;MATCH_PHRASE&lt;/code&gt;. For example, &lt;code&gt;SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2';&lt;/code&gt; Note that the &lt;code&gt;support_phrase&lt;/code&gt; attribute needs to be set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ordinary Equality, Range, IN, NOT IN Queries&lt;/strong&gt;: Use normal SQL statements. For example, &lt;code&gt;SELECT * FROM table_name WHERE id = 123;&lt;/code&gt; Analyze the acceleration effect of inverted indexes through Query Profile indicators such as &lt;code&gt;RowsInvertedIndexFiltered&lt;/code&gt; and &lt;code&gt;InvertedIndexFilterTime&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  (C) BloomFilter Indexes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Management
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Creation at Table Creation&lt;/strong&gt;: Specify which fields to create BloomFilter indexes on through the table's PROPERTIES "bloom_filter_columns", for example, &lt;code&gt;PROPERTIES ("bloom_filter_columns" = "column_name1,column_name2");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding and Deleting from Existing Tables&lt;/strong&gt;: Modify the bloom_filter_columns property of the table through ALTER TABLE. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ALTER TABLE table_name SET ("bloom_filter_columns" = "column_name1,column_name2,column_name3");

ALTER TABLE table_name SET ("bloom_filter_columns" = "column_name2,column_name3");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The former is to add indexes, and the latter is to delete indexes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;p&gt;They are used to accelerate equality queries in WHERE conditions, taking effect automatically with no special syntax required. Analyze the acceleration effect through Query Profile indicators such as &lt;code&gt;RowsBloomFilterFiltered&lt;/code&gt; and &lt;code&gt;BlockConditionsFilteredBloomFilterTime&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  (D) NGram BloomFilter Indexes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Management
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Creation&lt;/strong&gt;: Define the index after the COLUMN definition in the table creation statement. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INDEX `idx_column_name` (`column_name`) USING NGRAM_BF

PROPERTIES("gram_size"="3", "bf_size"="1024")

COMMENT 'username ngram_bf index'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Specify the index column name, index type (USING NGRAM_BF), and tokenization - related attributes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Viewing&lt;/strong&gt;: Use &lt;code&gt;SHOW CREATE TABLE table_name;&lt;/code&gt; or &lt;code&gt;SHOW INDEX FROM idx_name;&lt;/code&gt; to view indexes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deleting&lt;/strong&gt;: Use &lt;code&gt;ALTER TABLE table_ngrambf DROP INDEX idx_ngrambf;&lt;/code&gt; to delete indexes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modifying&lt;/strong&gt;: Use &lt;code&gt;CREATE INDEX&lt;/code&gt; or &lt;code&gt;ALTER TABLE ADD INDEX&lt;/code&gt; syntax to modify index definitions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;p&gt;They are used to accelerate LIKE queries, for example, &lt;code&gt;SELECT count() FROM table1 WHERE message LIKE '%error%';&lt;/code&gt; Analyze the acceleration effect through Query Profile indicators such as &lt;code&gt;RowsBloomFilterFiltered&lt;/code&gt; and &lt;code&gt;BlockConditionsFilteredBloomFilterTime&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  VI. Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, the Apache Doris index system is rich and powerful, with various indexes having their own strengths. Prefix indexes locate data based on the sorted structure, inverted indexes facilitate full - text retrieval, ZoneMap indexes skip irrelevant data blocks using statistical information, and BloomFilter indexes and NGram BloomFilter indexes accelerate equality and text LIKE queries respectively.&lt;/p&gt;

&lt;p&gt;By thoroughly understanding their principles, application scenarios, and usage methods, users can make accurate selections according to their needs, maximizing the performance of Doris in data queries. Whether it's point queries on massive data or complex text retrievals, Doris can handle them with ease.&lt;/p&gt;

&lt;p&gt;If you're really stuck, check the QueryProfile to see if the indexes are taking effect. There's nothing worse than implementing indexes that don't work!&lt;/p&gt;

</description>
      <category>apache</category>
      <category>doris</category>
      <category>bigdata</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
