The most of the database management systems use B-tree
as a data structure for increasing the performance.
Let's imagine that we have a table users
with the following columns: id (int)
, name (string)
, email (string)
, password (string)
, age (int)
. We want to select only ones that meet the condition: (name.contains("Bob") and not name.contains("A")) or (email.starts_with("angel") and (age >= 30 or age <= 20))
. It's a really complicated condition. How do the database management systems builds the B-tree
and how do they move inside them to select the data? Which key should be used inside B-tree
? If it's achievable with another data structure type, it is also welcomed!
I am creating my own RDBMS and faced with this problem :)