Updated on 2025-05-29 GMT+08:00

Optimization Data Query by Partition

Partitioned tables have advantages in data query when predicate queries are performed on partition keys. Take a table with the month as the partition key as an example, as shown in Figure 1.

Figure 1 Example of a partitioned table

If an ordinary table design is used, a full table scan is required for query. If the table is redesigned with the month as the partition key, the full table scan is optimized to a partition scan. When the table contains a large amount of data and involves a long period, the performance can be significantly improved by reducing the amount of data to be scanned, as shown in Figure 2.

Figure 2 Example of partition pruning