开发者

What algorithms does SQL use? [closed]

开发者 https://www.devze.com 2023-01-24 13:58 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Ive always wondered this but never had the chance to research it.

What sort of algorithms are use in SQL? Naturally you search and compare for b开发者_如何学运维asic statements, what search algorithms? Sorting? and for other functions like Join's etc.

I know there is no clear cut answer to this questions but the idea is to gather a general idea of what sort of methods SQL uses to carry out its work.


I would suggest you get a copy of SQL Server 2008 Internals by Delaney, Randal, Tripp and more. Excellent book on the internal workings of SQL Server.

http://www.amazon.com/Microsoft-SQL-Server-2008-Internals/dp/0735626243/ref=sr_1_1?s=books&ie=UTF8&qid=1289565465&sr=1-1


You can take a look at the Microsoft blog about SQL Server Query Processing, which discusses some SQL Server internals. (The originally linked Craig Freedman blog has been moved there.) Just browse for the interesting topics. If I understood it right, he also wrote some chapter for the already mentioned book series "SQL Server Internals".

You can search the above linked site for the following topics to shed some light on how the different JOIN algorithms work internally:

  • Nested Loop Join
  • Hash Join
  • Merge Join


Joins are performed in three methods: 1. Nested Loop 2. Hash 3. Merge

Get more about these join methods here:

http://www.sqlservercentral.com/articles/Advanced+Querying/optimizerjoinmethods/1708/


RDBMS composed of several elements:

  • Transaction manager -- manages transactions, as evident from it's name:)
  • Physical storage manager -- manages how data stored in underlying file-system(s)
  • Query parser/planner/executor -- this is 'user front-end' of database

Each of these elements is essential for any RDBMS and use different set of algorithms to make itself work.

If you interested in internals of RDBMS, get yourself this book: http://www.amazon.com/Database-Systems-Complete-Book-2nd/dp/0131873253/


SQL is a superset of relational algebra. At its basic level, you might want to become familiar with that some. Relational Algebra

0

精彩评论

暂无评论...
验证码 换一张
取 消