This project is a mini database engine implemented in Java. It provides basic database operations such as insertions, deletions, updates, and select operations. The project also uses B+Trees to optimize the performance of select queries.
- Supports 3 datatypes (Strings, Integers, Doubles).
- Stores tables, pages and indicies in
serialized
object files. - Stores
page ranges
(min and max clustering key of each page) for each table. - Supports
fast equality and range queries
by maintaining a balancedB+Tree
on desired column. - Saves metadata about tables in a CSV format, and uses
Singleton design pattern
to maintain a single instance of theMetadata class
throughout its usage.
- Insertions
- Runs in
O(N * log N)
to keep tuples sorted based on the tableclustering key
. - Finds appropriate insertion position by binary search on page ranges.
- Runs in
- Deletions
- Runs in
O(log N)
when deleting by clustering key or an indexed column. - Runs in
O(N)
otherwise.
- Runs in
- Updates
- Runs in
O(N)
to search for the tuple and update it.
- Runs in
- Select
- Time complexity of
O(K + log N)
for range queries on indexed columns. - N represents the total number of data items stored in the B+Tree.
- K represents the number of data items found within the specified range.
- Supports operators (=, !=, >, >=, <, <=) for each condition, and logical operators (AND, OR, XOR) between multiple conditions.
- Time complexity of
- Java
- Maven