近期项目需要用到分区表,但是分区键值有无法确定,因此只能使用hash分区(range、list分区以前常用,比hash分区简单),查询了文档,发现上面说的和实际使用时有点差距,就专门做实验验证下。
官方文档(11g、12c的解释都是一样的):
docs.oracle.com/database/121/CNCPT/schemaob.htm
Hash Partitioning
In hash partitioning, the database maps rows to partitions based on a hashing algorithm that the database applies to the user-specified partitioning key. The destination of a row is determined by the internal hash function applied to the row by the database. The hashing algorithm is designed to distribute rows evenly across devices so that each partition contains about the same number of rows.
Hash分区时,数据库根据hash算法映射行到用户指定的分区键中。行的存放目的地由数据库的内部hash函数来决定。hash算法的目的是在设备上均匀分布行,以便每个分区包含相同数量的行。
建表如下:
create table t_test_part(