# Main Functions Of Tidb Server
__*TiDB Server Functions*__
+ Handling client connections
+ parse and compiling SQL statements
+ Relational data and the transformation of KV
+ SQL statements execution
+ **Online DDL** execution
+ Garbage collection
+ Cached table **V6.0**

------------------------------------------------------------
As we can see from the thread pool structure of TiDB Server, the core functions of TiDB Server can be summarized as follows:

1. Handling client connections
Users are authenticated by username+password, and the connected users are empowered, which is primarily done by the Protocol Layer module.

2. parse and compiling SQL statements
After listening to the SQL statement, TiDB Server parses and compiles it. During the compilation process, it optimizes and generates an execution plan. These tasks are done by the Parse and Compile modules.

3. Relational data and the transformation of KV
Since data is stored on TiKV in the form of key value (KV), there is a big difference between relational data (table, index, and row) and KV structure. If you want to execute SQL, you must be able to convert between relational data and KV storage.

4. SQL statements execution
According to the compiled execution plan, it is executed on TiKV in batches. The data is read by the Executor module, the KV module, and the DistSQL module, and the transaction related operations are completed by the Transaction module and the KV module.

5. Online DDL execution
DDL operations do not lock tables. It is done by the schema load module, worker module and start job module.

1. Garbage collection
The GC background module is responsible for recovering data from old versions that have expired, and this part will be explained in the TiKV course.

7. Cached table (V6.0)
This function is suitable for hotspot subtables that are frequently accessed and rarely modify. That is, the data of the entire table is loaded into the memory of the TiDB server, and the table data is obtained directly from the memory, avoiding fetching table data from TiKV, thus improving the read performance.