What is the algorithm for query search in the database?

前端 未结 3 644
天命终不由人
天命终不由人 2021-02-06 01:08

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.

3条回答
  •  清酒与你
    2021-02-06 01:48

    Very gOod question, but it can have many answers depending on the structure of your table and how is normalized...

    Usually to perform a seacrh in a SELECT query the DBMS sorts the table (it uses mergesort because this algorithm is good for I/O in disc, not quicksort) then depending on indexes (if the table has) it just match the numbers, but if the structure is more complex the DBMS can perform a search in a tree, but this is too deep, let me research again in my notes I took.

    I recommend activating the query execution plan, here is an example in how to do so in Sql Server 2008. And then execute your SELECT statement with the WHERE clause and you will be able to begin understanding what is going on inside the DBMS.

提交回复
热议问题