Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Suggestions for Creating CarbonData Tables

Updated on 2024-11-29 GMT+08:00

Scenario

This section provides suggestions based on more than 50 test cases to help you create CarbonData tables with higher query performance.

Table 1 Columns in the CarbonData table

Column name

Data type

Cardinality

Attribution

msname

String

30 million

dimension

BEGIN_TIME

bigint

10,000

dimension

host

String

1 million

dimension

dime_1

String

1,000

dimension

dime_2

String

500

dimension

dime_3

String

800

dimension

counter_1

numeric(20,0)

NA

measure

...

...

NA

measure

counter_100

numeric(20,0)

NA

measure

Procedure

  • If the to-be-created table contains a column that is frequently used for filtering, for example, this column is used in more than 80% of filtering scenarios,

    implement optimization as follows:

    Place this column in the first column of sort_columns.

    For example, if msname is used most frequently as a filter criterion in a query, it is placed in the first column. Run the following command to create a table. The query performance is good if msname is used as the filter criterion.

    create table carbondata_table(
        msname String,
        ...
        )STORED AS carbondata TBLPROPERTIES ('SORT_COLUMS'='msname');
  • If the to-be-created table has multiple columns which are frequently used to filter the results,

    implement optimization as follows:

    Create an index for the columns.

    For example, if msname, host, and dime_1 are frequently used columns, the sort_columns column sequence is "dime_1-> host-> msname..." based on cardinality. Run the following command to create a table. The following command can improve the filtering performance of dime_1, host, and msname.

    create table carbondata_table(
        dime_1 String,
        host String,
        msname String,
        dime_2 String,
        dime_3 String,
        ...
        )STORED AS carbondata 
    TBLPROPERTIES ('SORT_COLUMS'='dime_1,host,msname');
  • If the frequency of each column used for filtering is similar,

    implement optimization as follows:

    sort_columns is sorted in ascending order of cardinality.

    Run the following command to create a table:

    create table carbondata_table(
        Dime_1 String,
        BEGIN_TIME bigint,
        HOST String,
        msname String,
        ...
        )STORED AS carbondata
    TBLPROPERTIES ('SORT_COLUMS'='dime_2,dime_3,dime_1, BEGIN_TIME,host,msname');
  • Create tables in ascending order of cardinalities. Then create secondary indexes for columns with more cardinalities. The statement for creating an index is as follows:
    create index carbondata_table_index_msidn on tablecarbondata_table (
    msname String) as 'carbondata' PROPERTIES ('table_blocksize'='128');
    create index carbondata_table_index_host on tablecarbondata_table (
    host String) as 'carbondata' PROPERTIES ('table_blocksize'='128');
  • For columns of measure type, not requiring high accuracy, the numeric (20,0) data type is not required. You are advised to use the double data type to replace the numeric (20,0) data type to enhance query performance.

    The result of performance analysis of test-case shows reduction in query execution time from 15 to 3 seconds, thereby improving performance by nearly 5 times. The command for creating a table is as follows:

    create table carbondata_table(
        Dime_1 String,
        BEGIN_TIME bigint,
        HOST String,
        msname String,
        counter_1 double,
        counter_2 double,
        ...
        counter_100 double,
        )STORED AS carbondata
    ;
  • If values (start_time for example) of a column are incremental:

    For example, if data is loaded to CarbonData every day, start_time is incremental for each load. In this case, it is recommended that the start_time column be put at the end of sort_columns, because incremental values are efficient in using min/max index. The command for creating a table is as follows:

    create table carbondata_table(
        Dime_1 String,
        HOST String,
        msname String,
        counter_1 double,
        counter_2 double,
        BEGIN_TIME bigint,
        ...
        counter_100 double,
        )STORED AS carbondata 
        TBLPROPERTIES ( 'SORT_COLUMS'='dime_2,dime_3,dime_1..BEGIN_TIME');

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback