Bird
0
0

If a hash partitioned table has 3 partitions with modulus 3, what happens when you insert a row with a key value of 10?

medium📝 query result Q5 of 15
PostgreSQL - Table Partitioning
If a hash partitioned table has 3 partitions with modulus 3, what happens when you insert a row with a key value of 10?
AIt goes to partition with remainder 0
BIt goes to partition with remainder 1
CIt causes an error because 10 is not divisible by 3
DIt is duplicated in all partitions
Step-by-Step Solution
Solution:
  1. Step 1: Calculate remainder of 10 modulo 3

    10 % 3 = 1.
  2. Step 2: Assign to partition with remainder 1

    Row goes to partition where remainder equals 1.
  3. Final Answer:

    It goes to partition with remainder 1 -> Option B
  4. Quick Check:

    Hash partitioning uses remainder to assign partitions [OK]
Quick Trick: Use key % modulus to find partition remainder [OK]
Common Mistakes:
  • Thinking key must be divisible by modulus
  • Assuming duplicates in all partitions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes