This project aims to mock a database management system by
- Mocking a hard disk which requires IO and processing when it is fetched into the main memory and it could only be fetched in blocks
- Implementing a B+ tree for indexing
By logically arranging the data and forming a B+ tree, we then analyse the number of I/Os required to perform actions on the data set. These actions include searching, inserting and deleting records.
We then further experiment by changing the block size and reviewing how it affects the storage and indexing capabilities of the B+ tree.
We implemented this project in C++ language.
Overall structure of database management system:
- gcc 4.8+ | clang 3.5+
- cmake 3.11+
- gtest
Open terminal and enter the following commands:
sudo apt-get update && sudo apt-get install cmake && sudo apt-get install g++
Cmake and g++ will then be installed.
To check that cmake and gcc is installed:
gcc --version
cmake --version
You should be able to see the version that u have downloaded
Open terminal from spotlight and enter the following commands:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && brew install gcc && brew install cmake
Cmake and g++ will then be installed.
To check that cmake and gcc is installed:
gcc --version
cmake --version
You should be able to see the version that u have downloaded
Please ensure that you have a active wifi connection as gtest module will be fetch automatically
cmake -H. -Bbuild
cd build && make
In the dbms directory:
./build/bin/dbms
Run test:
./build/bin/dbms_test
Before building the project, please change line 83 of the main.cpp file to the absolute path of the data folder. (This is because in windows, the parent dir of executable file might be in different folder due to the difference in ide)
Ensure the following dependencies are installed:
- CMake
- MSYS2 (After downloading the MSYS2 installer, follow all the steps in the website to install mingw64 and related dependencies.)
Perform the following steps:
- Open the source code in VSCode.
- Install the CMake tools extension in VSCode: CMake Tools.
- Set the CMake Tools environment variables:
- You need to open the
settings.json
by Ctrl + Shift + P and search-selectPreference: Open settings (JSON)
- Add the lines below:
"cmake.cmakePath": "C:\\msys64\\mingw64\\bin\\cmake.exe", "cmake.mingwSearchDirs": [ "C:\\msys64\\mingw64\\bin" ], "cmake.generator": "MinGW Makefiles"
- You need to open the
- Click on the wrench icon located at the bottom bar and select
GCC 10.3.0 x86_64-w64-mingw32
, which is the latest version as of 2/10/2021. - Click on the
Build
button with a gear icon, located at the bottom bar of the VSCode window. - Once done, navigate to the executable in build/bin/dbms.exe and run the dbms.exe executable to start. The project will open in a command shell