We will be undergoing scheduled maintenance on May 20th, 2013 at 02:00 GMT.
Next, we want to go a little deeper into the MySQL server itself and take a look at some of the subsystems that are in the server that make it tick, that make it do what it does to be able to retrieve information for us, where to update information for us. So there are a number of characteristics that we need to be aware of for the MySQL server and the implications of these things will become clearer as we go further into this course and into the Part 2 course. The first part is that MySQL D, the server program is a single process. That differs from some other older database management systems that are out there that launch a new process for each connection to the database. Here we're running a little bit leaner, we have a single process that happens to be multi-threaded and each connection to this process is a thread inside of the process that communicates with a specific client. The MySQL server itself has a very nice modern modular design for the different subsystems that are inside of it and they communicate with each other and work together to solve the problems that we give it. Among those modules are various storage engines so we assign a storage engine to a table and that table then is managed by that storage engine. But there's no conflict in having a query that addresses multiple tables that may have different storage engines. That's not an issue. Okay. Let's go a little bit deeper and look at some of the subsystems and see what we call them at least and then I'll show you how they kind of work together in a schematic fashion. So one of the subsystems is a connection interface. It's a way of communicating with the outside world. Clients will address the server the server will perhaps listening on a TCP/IP port, listening through a socket file or something and so the connection interface is launched and addressed when a communication is addressed to the server. There are a number of core subsystems that perform different utility operations for us that may be called from any number of other more specialized subsystems inside the MySQL server. One of these specialized subsystems is the query parser and as the name implies it then breaks down the query into a form that the MySQL server can handle and passes it on. There are a number of different caches that help to enhance the performance of the MySQL server. The queries from the query parser are passed onto the query optimizer which determines what is going to be the best execution plan and then that the execution plan is passed onto the execution engine. And the execution engine in turn is the one part of the MySQL server eco system here that communicates with the storage engines. And the storage engines are the only things that go out and actually touch the data. So it's a very nice little system that they've set up. Let me show you a schematic diagram of how this works for performing a simple query operation. So here we have a schematic of the MySQL server. Now this is the program MySQL D running in the background just waiting for somebody to ask it to do something. And here maybe we have a number of remote computers, as is depicted or maybe they're just other processes on the same host machine. But they want to communicate with the MySQL server and perform some kind of an action or have the MySQL server perform some kind of an action for them. So they pass a message to the communication interface and that communication interface acts as a traffic cop when there's a lot of communications coming in at the same time, trying to make sure that everybody gets their thing done in their turn. The query is passed onto the SQL parser but rather than parsing the query right away, if the query cache is turned on, that's one of these performance cache's, then the SQL parser simply hashes the query, runs an algorithm on it to turn it into a hash that's a technical term. And the query cache is then basically a database or an index of hashed queries that also carries along with the query, the results set for that query. And so it searches out trying to see whether that hash is there and if it is there, it immediately sends back to the client through the connection thread, the results set for that query. The query parser and all the other things didn't have to do any work at all. But that's not always the case. So if the query that is hashed can't be found in the query cache then the SQL parser instead has to look at the code of the query, break it down and reformulate that in a binary format that can be worked with internally inside the server. So it takes that text and it converts it into a more meaningful to the server binary format. That's passed on to the query optimizer and the query optimizer has access to a number of index statistics, table statistics and all kinds of things and it performs a number of calculations using that information and comes up with a query execution plan. The execution plan is then passed off to the execution module and it sets things into motion, passing off various parts of the execution plan to the different storage engines that are in charge of the tables that might be part of this query. Those storage engines then go off and gather the data. They may work separately or they may work in a tag team fashion. But they send the results back to the execution engine which performs a few more operations and eventually packages up the results set for sending back to the client and it sends it back through that same connection thread. So that's basically how the server operates. What we want to do now is break that down further and get to know these subsystems and other subsystems a little bit better and then we'll move onto other more detailed things that the database administrator has to know in order to manage this whole system.
| 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 |