Partitioning is a built-in feature of OceanBase Database. You only need to specify the partitioning strategy and the number of partitions when you create a table. The SQL queries for a partitioned table are the same as those for a regular table. OBProxy or OBServer of OceanBase automatically routes SQL queries of users to the corresponding nodes. The partitioning details of a partitioned table are transparent to the applications.
If you know the partition number of the data you want to read, you can run SQL queries to directly access the partition in the partitioned table. Basic syntax:
part_table partition ( p[0,1,...][sp[0,1,...]] )
By default, unless you define the partition names, each partition is given a number as its name based on a particular rule. For example:
Partition names, such as p0, p1, and p2.
Subpartition names, such as p0sp0, p0sp1, p0sp2, p1sp0, p1sp1, and p1sp2.
Example: Accessing a specific partition in a partitioned table
select * from t_log partition (p0) ;
select * from t_log partition (p5sp0) ;