Bird
0
0

Identify the error in this partition creation:

medium📝 Debug Q6 of 15
PostgreSQL - Table Partitioning
Identify the error in this partition creation:
CREATE TABLE logs (id INT, message TEXT) PARTITION BY HASH (id);
CREATE TABLE logs_p0 PARTITION OF logs FOR VALUES WITH (MODULUS 3, REMAINDER 3);
AMissing PRIMARY KEY on partitioned table
BPartition table must have different column names
CHash partitioning requires RANGE, not HASH
DRemainder value cannot be equal to modulus
Step-by-Step Solution
Solution:
  1. Step 1: Check remainder value validity

    Remainder must be between 0 and modulus-1; remainder 3 is invalid for modulus 3.
  2. Step 2: Confirm other options

    Other options are incorrect because column names can be same, HASH is correct, and primary key is optional.
  3. Final Answer:

    Remainder value cannot be equal to modulus -> Option D
  4. Quick Check:

    Remainder < modulus in hash partitions [OK]
Quick Trick: Remainder must be less than modulus [OK]
Common Mistakes:
  • Setting remainder equal to modulus
  • Confusing partition types
  • Assuming primary key is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes