Bird
Raised Fist0
HLDsystem_design~20 mins

Horizontal vs vertical partitioning in HLD - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Partitioning Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Horizontal Partitioning

Which of the following best describes horizontal partitioning in database design?

ADividing a table into multiple tables each containing a subset of columns
BMerging multiple tables into one large table to improve query speed
CCreating a backup of the entire database on multiple servers
DSplitting a table into multiple tables each containing a subset of rows based on a key
Attempts:
2 left
💡 Hint

Think about dividing data by rows rather than columns.

🧠 Conceptual
intermediate
2:00remaining
Understanding Vertical Partitioning

Which option correctly explains vertical partitioning in database systems?

ACombining multiple tables into one to reduce joins
BSplitting a table into smaller tables each containing a subset of columns
CCreating multiple copies of the same table for redundancy
DDistributing rows of a table across multiple servers
Attempts:
2 left
💡 Hint

Focus on dividing data by columns instead of rows.

❓ scaling
advanced
3:00remaining
Choosing Partitioning for Large User Data

You have a user database with millions of records and many columns. You want to improve query speed for user profile info and reduce server load. Which partitioning strategy is best?

AVertical partitioning by splitting frequently accessed profile columns from less used columns
BNo partitioning, keep all data in one table for simplicity
CHorizontal partitioning by user region to distribute rows across servers
DCreate multiple full copies of the user table on different servers
Attempts:
2 left
💡 Hint

Consider which data is accessed most often and how to reduce data scanned per query.

❓ tradeoff
advanced
3:00remaining
Tradeoffs Between Horizontal and Vertical Partitioning

Which statement correctly describes a tradeoff when choosing between horizontal and vertical partitioning?

AVertical partitioning eliminates the need for database normalization
BVertical partitioning reduces the number of rows but increases the number of columns in each table
CHorizontal partitioning improves write scalability but can increase complexity in queries joining multiple partitions
DHorizontal partitioning always reduces the need for indexes on tables
Attempts:
2 left
💡 Hint

Think about how data is split and how queries might be affected.

❓ estimation
expert
4:00remaining
Estimating Storage Savings with Vertical Partitioning

A table has 1 million rows and 50 columns. 10 columns are accessed frequently and 40 rarely. Each row is 1 KB total. If vertical partitioning splits the table into two tables (10 columns and 40 columns), approximately how much storage is saved when querying only the frequently accessed columns?

AAbout 80% storage saved per query by scanning only 10 columns
BNo storage saved because all data is still stored together
CAbout 20% storage saved because 10 columns are smaller than 40
DAbout 50% storage saved because half the columns are separated
Attempts:
2 left
💡 Hint

Consider the proportion of columns accessed and data scanned per query.

Practice

(1/5)
1. Which of the following best describes horizontal partitioning in system design?
easy
A. Combining multiple tables into one large table
B. Splitting a database table into multiple tables by columns
C. Splitting a database table into multiple tables by rows
D. Duplicating the entire database for backup

Solution

  1. Step 1: Understand horizontal partitioning

    Horizontal partitioning means dividing data by rows, so each partition holds a subset of rows.
  2. Step 2: Compare with other options

    Vertical partitioning splits by columns, combining tables merges data, and duplication is for backup, not partitioning.
  3. Final Answer:

    Splitting a database table into multiple tables by rows -> Option C
  4. Quick Check:

    Horizontal partitioning = splitting by rows [OK]
Hint: Rows split = horizontal, columns split = vertical [OK]
Common Mistakes:
  • Confusing horizontal with vertical partitioning
  • Thinking partitioning means duplicating data
  • Mixing partitioning with database backup
2. Which syntax correctly describes vertical partitioning?
easy
A. Splitting data by rows into multiple tables
B. Splitting data by columns into multiple tables
C. Merging rows from different tables
D. Backing up the entire database

Solution

  1. Step 1: Define vertical partitioning

    Vertical partitioning splits a table by columns, separating attributes into different tables.
  2. Step 2: Eliminate incorrect options

    Options about rows, merging, or backup do not describe vertical partitioning.
  3. Final Answer:

    Splitting data by columns into multiple tables -> Option B
  4. Quick Check:

    Vertical partitioning = splitting by columns [OK]
Hint: Columns split = vertical partitioning [OK]
Common Mistakes:
  • Confusing vertical with horizontal partitioning
  • Assuming partitioning means merging tables
  • Mixing partitioning with backup processes
3. Consider a user database table with columns: id, name, email, password, address. If we apply vertical partitioning by splitting sensitive data into a separate table, which of the following is a valid partition?
medium
A. Table 1: id, password; Table 2: name, email, address
B. Table 1: id, name; Table 2: email, password, address
C. Table 1: id, name, password; Table 2: email, address
D. Table 1: id, name, email; Table 2: id, password, address

Solution

  1. Step 1: Identify sensitive data columns

    Password and address are sensitive, so they should be separated from general info.
  2. Step 2: Check partitioning by columns

    Table 1: id, name, email; Table 2: id, password, address separates password and address into one table, and id, name, email into another, matching vertical partitioning.
  3. Final Answer:

    Table 1: id, name, email; Table 2: id, password, address -> Option D
  4. Quick Check:

    Vertical partitioning splits columns, sensitive data separated [OK]
Hint: Sensitive columns go to separate table in vertical partitioning [OK]
Common Mistakes:
  • Mixing rows and columns in partitioning
  • Not separating sensitive data properly
  • Splitting columns unevenly without reason
4. A system uses horizontal partitioning by user region but experiences slow queries on user emails. What is the likely cause and fix?
medium
A. Cause: Partitioning by rows only; Fix: Add vertical partitioning to separate email column
B. Cause: Partitioning by columns only; Fix: Add horizontal partitioning by region
C. Cause: No partitioning; Fix: Add horizontal partitioning by email
D. Cause: Too many partitions; Fix: Merge all partitions into one

Solution

  1. Step 1: Analyze the problem

    Horizontal partitioning splits by rows (region), but email queries are slow because email column is not separated.
  2. Step 2: Suggest fix

    Adding vertical partitioning to separate email column improves query speed on emails.
  3. Final Answer:

    Cause: Partitioning by rows only; Fix: Add vertical partitioning to separate email column -> Option A
  4. Quick Check:

    Slow email queries fixed by vertical partitioning [OK]
Hint: Slow column queries? Add vertical partitioning [OK]
Common Mistakes:
  • Confusing cause with partition type
  • Suggesting wrong partitioning fix
  • Ignoring query patterns in design
5. You design a large e-commerce database with millions of orders. You want to improve performance by splitting data. Which approach is best and why?
hard
A. Use horizontal partitioning by customer ID and vertical partitioning by payment info for balanced load
B. Use vertical partitioning by splitting order details and customer info into separate tables to reduce row size
C. Use no partitioning and rely on caching for performance
D. Use horizontal partitioning by order date to distribute rows across servers, improving query speed on recent orders

Solution

  1. Step 1: Understand data and query patterns

    Orders have many rows and columns; splitting by customer ID (horizontal) balances load; splitting payment info (vertical) reduces row size.
  2. Step 2: Evaluate options

    Use horizontal partitioning by customer ID and vertical partitioning by payment info for balanced load combines horizontal and vertical partitioning for scalability and performance, better than single approach or no partitioning.
  3. Final Answer:

    Use horizontal partitioning by customer ID and vertical partitioning by payment info for balanced load -> Option A
  4. Quick Check:

    Combine horizontal and vertical partitioning for large data [OK]
Hint: Combine horizontal and vertical for big, complex data [OK]
Common Mistakes:
  • Using only one partitioning type for complex data
  • Ignoring query patterns and data distribution
  • Relying solely on caching without partitioning
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard