DB partitioning
DB partitioning
husseinnasser.com
● What is Partitioning?
● Horizontal Partitioning vs Vertical Partitioning
● Partitioning Types
● Partitioning vs Sharding
● Demo
● Pros & Cons
● Summary
CUSTOMERS Table
What is Partitioning?
id NAME
1 Ali
.. ….
... ...
700,001 Kim
700,002 Ali
.. ...
1M James
CUSTOMERS_200K
id NAME
What is Partitioning? 1 Ali CUSTOMERS_800K
... .. id NAME
SELECT Name
FROM CUSTOMERS_TABLE 200,000 Edmond 600,001 Nada
WHERE ID = 700,001
... ..
CUSTOMERS_400K
Which “partition” is customer 700,001
700,001 Kim
in? id NAME
Partition CUSTOMERS_800K ... ...
200,001 James
800,000 Tyler
... ..
400,000 Smith
● By Range
○ Dates, ids (e.g. by logdate or customerid from to)
● By List
○ Discrete values (e.g. states CA, AL, etc.) or zip codes
● By Hash
○ Hash functions (consistent hashing)
Horizontal Partitioning vs Sharding
● What is Partitioning?
● Horizontal Partitioning vs Vertical Partitioning
● Partitioning Types
● Partitioning vs Sharding
● Pros & Cons