I learnt that B+ Trees are used for implementing RDBMS , and Now i want to implement an RDBMS in C/C++ , i've read about B+ Trees and also saw the SQLite.
I have a conceptual doubt of how the Search Query works on Database, we store (key,values) on the B+ Tree ,Now say i had a table
with columns {id,name,phone,address}
and i have to search for the record with phone = 'xyz' , how will database use B+ Trees to efficiently get that record.
Is it complete O(N) search on the records or optimized?
It is a complete O ( N ) search if you do not have an index.
It is optimized if you have an index.
Average case O(logb(n))
Worst Cast O(n)
A B+ tree is a blanced tree , it works more like binary search tree specially in MYSQL . its implementation can be varied.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.