database - How does a DBMS implement their own sorting algorithm? Or do they? -


when sql translated c parser such yacc or bison, piece of translated c code contains the sorting algorithm mathematics? not understand how sorting implemented in dbms (such mysql or microsoft sql server) - algorithm part of grammar parser? or, algorithm applies resulted group of data after fetched sql query, not directly apply computer memory? or sorting algorithm iso standard , dbms required use same algorithm?

i did researched , googling find no clear answer. without unneedingly reading book on database internal, explain concept clearly?

the sorting algorithm not part of grammar parser, it's technically 'implementation detail'. it's rather important 1 though, can fundamentally impact performance of complex queries. term 'implementation detail' refers it's dbms vendor decide , how it.

it partially delegated query optimizer, common sorting algorithms heapsort, mergesort, quicksort et al have different 'best case scenarios'. perform notably better on 'mostly sorted data', , others extremely slow on 'extremely unsorted data'. indexes contain hints on smart dbms pick different sorting algorithm based on data @ hand, see wikipedia writeup comparison. knowledge none of current vendors though.

so in end, sorting algorithms used when black box programmer's perspective. (should) care output sorted correctly.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -