Another really important subsystem because it's used all the time is the query parsing subsystem. So we have an SQL parser built into the MySQL server and it's job basically is to convert the text of the SQL that's coming in, into a more useful binary format that follows some internal rules and has some internal structures to it that are useful to other parts of the query execution collection of subsystems. Now it includes two primary modules here. The first one we call the Lexical Scanner and this understands what the various keywords are in SQL. It understands what tables and column names and so on that we have in our system. And it seeks those out and it has a way of assigning symbols shortcut codes, essentially called tokens, to each of these items. The second main module here of the parser system is the Grammar Rules Module. It understands how these things then are supposed to fit together but it knows how to work with those things as the tokens rather than as text. So first we have to scan through the query to figure out what are the elements that are in there and make sure that everything was spelled correctly. If it wasn't spelled correctly then it won't be able to find that in it's internal dictionary and it won't have any idea how to tokenize it and so it will send back an error. Once that job has been done, then the grammar rules are applied to make sure that the statement was syntactically correct in the first place. And all the clauses in your Select Statement and so on were in the proper order. Okay. So it parses the SQL into tokens and these are basically numeric representations, shorter ones of the various keywords in the SQL language. Of the tables, of the fields of the databases, all of those things that we might have to use back tick quotes for if we wanted to formalize our SQL Statement. And it applies the grammar rules to make sure that the whole thing is valid. And then from that it constructs what's called a parse tree. And it passes that on to the query optimizer. Now you can see this is a fair amount of work and we haven't gotten to the optimizer yet. So we may want to see if there's a possibility of bypassing this and that is the job of the query cache. Now, we've discussed the query cache a little bit just in passing as one of the performance caches but I'd like to spend a little bit more time on that and explain that a little bit more thoroughly. So that's what we'll cover in the next lesson.
| Course: | MySQL 5 Administration-Part 1 |
| Author: | David Swain |
| SKU: | 34307 |
| ISBN: | 978-1-61866-086-2 |
| Release Date: | 2012-12-31 |
| Duration: | 16 hrs / 171 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |