# Tidb Server Functions

+ Handle client connections
+ parse and compiling SQL statements
+ Transformation of relational data and KV
+ Execution of SQL statements
+ Execution of online DDL
+ Garbage collection
------------------------------------------------------------
As we can see from the thread pool structure of TiDB Server, the core functions of TiDB Server can be summarized as follows:

- Handle client connections
  - Users authenticate with a username+password and authorize connected users. These tasks are mainly done by the Protocol Layer module.

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

- Transformation of relational data and KV
  - Since data is stored on TiKV as key values (KV), there is a big difference between relational data (tables, indexes, and rows) and KV structures. If you want to execute SQL, you must be able to convert between relational data and KV storage.

- Execution of SQL statements
  - Executor module, KV module, and DistSQL module perform data reading in batches according to the compiled execution plan, and transaction related operations are completed by the Transaction module and KV module.

- Execution of online DDL
  - TiDB database implement the function that DDL operations do not lock tables, and is done by the schema load module, worker module, and start job module.

- Garbage collection
  - The GC backend module is responsible for recovering old version data that has expired. This part will be explained in the TiKV course.