Example - PARTITION BY HASH v11

The following example creates a partitioned table (sales) using the PARTITION BY HASH clause. The sales table stores information in three partitions (p1, p2, and p3).

CREATE TABLE sales
(
  dept_no     number,
  part_no     varchar2,
  country     varchar2(20),
  date        date,
  amount      number
)
PARTITION BY HASH (part_no)
(
  PARTITION p1,
  PARTITION p2,
  PARTITION p3
);

The table is partitioned by the hash value of the value specified in the part_no column.

edb=# SELECT partition_name, high_value from ALL_TAB_PARTITIONS;
 partition_name |                high_value
----------------+------------------------------------------
 P1             | FOR VALUES WITH (modulus 3, remainder 0)
 P2             | FOR VALUES WITH (modulus 3, remainder 1)
 P3             | FOR VALUES WITH (modulus 3, remainder 2)
(3 rows)

The server will evaluate the hash value of the part_no column and distribute the rows into approximately equal partitions.