Help Center/
GaussDB/
Developer Guide(Distributed_8.x)/
SQL Reference/
SQL Syntax/
S/
SELECT/
Partition Queries
Updated on 2024-06-03 GMT+08:00
Partition Queries
Queries data in a specified partition.
-- Create a range partitioned table. gaussdb=# CREATE TABLE test_range1( id INT, info VARCHAR(20) ) PARTITION BY RANGE (id) ( PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN (400), PARTITION p3 VALUES LESS THAN (600), PARTITION p4 VALUES LESS THAN (800), PARTITION pmax VALUES LESS THAN (MAXVALUE) ); -- Insert 1000 data records. gaussdb=# INSERT INTO test_range1 VALUES(GENERATE_SERIES(1,1000),'abcd'); -- Query the number of data records in the p1 partition. gaussdb=# SELECT COUNT(*) FROM test_range1 PARTITION (p1); count ------- 199 (1 row) -- Delete. gaussdb=# DROP TABLE test_range1;
Parent topic: SELECT
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.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot