Bird
0
0

You want to distribute a large logs table by hashing the user_id column into 5 partitions. Which of the following is the correct way to define the partitions?

hard📝 Application Q15 of 15
PostgreSQL - Table Partitioning
You want to distribute a large logs table by hashing the user_id column into 5 partitions. Which of the following is the correct way to define the partitions?
ACreate 5 partitions with MODULUS 6 and REMAINDER values from 0 to 5
BCreate 5 partitions with MODULUS 4 and REMAINDER values from 0 to 4
CCreate 5 partitions with MODULUS 5 and REMAINDER values from 0 to 4
DCreate 5 partitions with MODULUS 5 and REMAINDER values from 1 to 5
Step-by-Step Solution
Solution:
  1. Step 1: Understand modulus and remainder for partitions

    MODULUS is total partitions count; REMAINDER ranges from 0 to MODULUS-1.
  2. Step 2: Apply to 5 partitions

    MODULUS must be 5; REMAINDER values must be 0,1,2,3,4 for 5 partitions.
  3. Final Answer:

    Create 5 partitions with MODULUS 5 and REMAINDER values from 0 to 4 -> Option C
  4. Quick Check:

    Partitions = MODULUS 5, REMAINDER 0-4 [OK]
Quick Trick: Use MODULUS = partitions count; REMAINDER from 0 to MODULUS-1 [OK]
Common Mistakes:
  • Setting remainder range incorrectly
  • Using wrong modulus number
  • Starting remainder at 1 instead of 0

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes