هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.
- Service Overview
- Billing
- Getting Started
-
User Guide
-
HBase User Guide
-
HBase Cluster Management
- Overview
- Managing Clusters
- Preparing an ECS
- Using HBase
- HBase Cold and Hot Data Separation
- HBase Thrift Server
- HBase Security Channel Encryption
- HBase Batch Data Import
- HBase Monitoring Clusters
- Self-Healing from HBase Hotspotting
- Global Secondary Indexes
-
HBase Cluster Management
-
ClickHouse User Guide
-
ClickHouse Cluster Management
- Overview
- Managing ClickHouse Clusters
- Using ClickHouse
- Migrating ClickHouse Data
- ClickHouse User Management
- ClickHouse Role Management
- ClickHouse Slow Query Management
- Configuring Secure Channel Encryption for ClickHouse Clusters
- Application of ClickHouse Cold and Hot Data Separation
- ClickHouse Monitoring Clusters
-
ClickHouse Cluster Management
- Permissions Management
- Audit Logs
- Cluster Log Management
-
HBase User Guide
-
Developer Guide
- HBase Application Development Guide
- ClickHouse Application Development Guide
-
FAQs
-
General
- What Services Does a CloudTable Cluster Provide?
- Why Do I Choose CloudTable Service?
- How Do I Prepare for Creating a CloudTable HBase Cluster?
- What Should I Pay Attention to When Using CloudTable Service?
- What Compression Algorithms Are Supported by CloudTable HBase Clusters?
- Can I Stop CloudTable Service?
- Which Programming Languages Are Supported by HBase External APIs in CloudTable?
- How Do I Determine the Number of Faulty RegionServers?
- What Special Characters Does CloudTable HBase Support?
- What Can I Do If the Index Table Does Not Match the Data Table After CloudTable Data Is Deleted?
- What Should I Do If Concurrent Tasks Run Slowly When Python Accesses CloudTable Through Thrift?
- How do I view the TTL attribute of HBase shell?
- Why Are My Server Resources Released?
- How Do I Delete a Cluster?
- How Do I Stop Services and Release Resources?
-
Connection and Access
- How Do I Access a CloudTable Cluster?
- Can I Use SSH to Access Computing Nodes of CloudTable?
- Why Can't I Access HBase After the ZK Address Is Configured?
- Why Is the Error "Will not attempt to authenticate using SASL (unknown error)" Reported When Connecting to HBase?
- How Do I View the IP Address Corresponding to a Domain Name in a CloudTable Link?
- How Do I Access CloudTable from Other Cloud Services?
- Can I Configure the hbase-site.xml File?
- How Do I Query the Creation Time of a Table in CloudTable HBase?
-
Data Read/Write
- Is Raw Data Stored in CloudTable HBase?
- Why Can't I Write Data to HBase?
- What Is the Maximum Size of Data Written to the HBase Cluster?
- How Do I Check the Daily Incremental Data in HBase Tables?
- What Should I Do If an Error Is Reported When I Access the CloudTable HBase Cluster?
- How Do I Delete the Backup Table of the ZooKeeper Node in the ClickHouse Cluster?
- What Should I Do If a Database Missing Error Occurs When a Table Is Created in the ClickHouse Cluster?
- Billing FAQs
-
General
- General Reference
Show all
Copied.
CREATE MATERIALIZED VIEW
This topic describes how to create a materialized view in ClickHouse.
Creating a Materialized View
CREATE MATERIALIZED VIEW [IF NOT EXISTS] [db.]Materialized_name [TO[db.]name] [ON CLUSTERClickHouse cluster name] ENGINE = engine_name() ORDER BY expr [POPULATE] AS SELECT ...
Parameter |
Description |
---|---|
db |
Name of the database. The default value is the selected database. |
Materialized_name |
Name of the materialized view. |
TO[db.]name |
This parameter specifies that the data of the materialized view is inserted into a new table. |
[ON CLUSTER ClickHouse cluster name] |
This parameter specifies that a materialized view is created on each node. The parameter format is ON CLUSTER ClickHouse cluster name. |
ENGINE = engine_name() |
Table engine type. |
[POPULATE] |
POPULATE keyword. If you specify the POPULATE keyword when you create a materialized view, the data in the source table that is specified in the SELECT clause is inserted into the materialized view when the materialized view is being created. Otherwise, the materialized view contains only the data that is inserted into the source table after the materialized view is created. The POPULATE keyword is not recommended because the data that is written to the source table when the materialized view is being created is not inserted into the materialized view. |
SELECT ... |
SELECT clause. When you insert data into the source table that is specified in the SELECT clause in the materialized view, the inserted data is transformed by the SELECT query and the final result is inserted into the materialized view. A SELECT query can contain DISTINCT, GROUP BY, ORDER BY, and LIMIT. The corresponding transformations are performed independently on each block of the data that is inserted. |
Examples:
- Create a source table.
create table DB.table1 ON CLUSTER default_cluster (id Int16,name String) ENGINE = MergeTree() ORDER BY (id);
- Insert data.
insert into DB.table1 values(1,'X'),(2,'Y'),(3,'Z');
- Create a materialized view based on the source table.
CREATE MATERIALIZED VIEW demo_view ON CLUSTER default_cluster ENGINE = MergeTree() ORDER BY (id) AS SELECT * FROM DB.table1;
- Query the materialized view.
SELECT * FROM demo_view;
NOTE:
If the query result is empty, the data that is written to the source table before the materialized view is created cannot be queried if the POPULATE keyword is not specified.
- Insert data to the DB.table1 table.
insert into demo_view values(4,'x'),(5,'y'),(6,'z');
- Query the materialized view.
SELECT * FROM demo_view;
The following query result is returned:
┌─id─┬─name─┐ │ 4 │ x │ │ 5 │ y │ │ 6 │ z │ └────┴──────┘
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot