Bird
0
0

Why does this hash partitioning setup fail?

medium📝 Debug Q7 of 15
PostgreSQL - Table Partitioning
Why does this hash partitioning setup fail?
CREATE TABLE data (key INT, value TEXT) PARTITION BY HASH (key);
CREATE TABLE data_p0 PARTITION OF data FOR VALUES WITH (MODULUS 2, REMAINDER 0);
AMODULUS must be greater than 2
BPartition tables cannot be named with suffixes
CMissing partition for remainder 1
DHash partitioning requires a UNIQUE constraint
Step-by-Step Solution
Solution:
  1. Step 1: Check completeness of partitions

    With modulus 2, partitions must cover remainder 0 and 1; only remainder 0 partition exists.
  2. Step 2: Validate other options

    MODULUS can be 2; naming is allowed; UNIQUE constraint not required.
  3. Final Answer:

    Missing partition for remainder 1 -> Option C
  4. Quick Check:

    All remainders must have partitions [OK]
Quick Trick: Create partitions for all remainders 0 to modulus-1 [OK]
Common Mistakes:
  • Creating incomplete partitions
  • Misunderstanding modulus value rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes