Good day everyone, I\'m currently doing research on search algorithm optimization.
As of now, I\'m researching on the Database.
In a database w/ SQL Support.
Well, it depends on how the data is stored and what are you trying to do.
k
levels of the tree can be stored in RAM, and only the few bottom levels will be stored on disk and require a disk read for each.O(1)
disk accesses (which is usually the bottleneck when dealing with data bases), so it should be relatively fast.
The disadvantage of all of the above is that it requires a single key - i.e. if the hash table or B+ tree is built according to the field "id" of the relation, and then you search according to "key" - it becomes useless.
If you want to guarantee fast search for all fields of the relation - you are going to need several structures, each according to a different key - which is not very memory efficient.
Now, there are many optimizations to be considered according to the specific usage. If for example, number of searches is expected to be very small (say smaller loglogN of total ops), maintaining a B+ tree is overall less efficient then just storing the elements as a list and on the rare occasion of a search - just do a linear search.