Hash partitioning is similar to range partitioning except that the partition key is hashed and the rows spread evenly across the assigned tablespaces. This kind of partitioning is convenient when the distribution of the rows might not be even, or no well-defined grouping of the key fields exists (as in the situation of the date field in the range partitioning example). Figure 15.2 illustrates how the tablespaces might appear for a hash-partitioned table, and Listing 15.3 shows the syntax needed to support the example in Figure 15.2. Notice no MAXVALUE clause exists with hash partitioning.
NOTE
Hashing algorithm— Takes a key field and applies a calculation to it that always equals a real number. This number then becomes the position in the table or index for the row or key value. In any kind of hash organization, you almost always need to know about how big the object will be so that Oracle can allocate enough hash positions to hold all the possible key values.
CREATE TABLE st_sales (sales_customer_id NUMBER(6), sales_sale_date DATE, sales_sale_amt NUMBER(9,2)) PARTITION BY HASH(sales_customer_id) (PARTITION p1 TABLESPACE ST_SALES_p1, PARTITION p2 TABLESPACE ST_SALES_p2, PARTITION p3 TABLESPACE ST_SALES_p3, PARTITION p4 TABLESPACE ST_SALES_p4 ); ok pm |
3.14.80.45