# Coprocessor - Cont'd

![`smart`](Coprocessor03_aa_002_2022051.png)

------------------------------------------------------------------------------
We pushed SQL computation down to TiKV, which is completed by TiKV's Coprocessor component, and its workflow is as follows:

1. The TiDB server receives the query statement, analyzes it, calculates the physical execution plan, and then decomposes the Coprocessor requests for TiKV.

2. TiDB server will distribute the Coprocessor request to all relevant TiKV nodes according to the data distribution.

3. After receiving the Coprocessor request, the TiKV server filters, aggregates, and performs other operations on the data according to the requested operator, and then returns it to TiDB.

4. After TiDB receives the return results of all the data, it performs secondary aggregation and calculates the final result, and returns it to the client.

TiKV Coprocessor currently handles requests in 3 categories.

- DAG: Execute physical operators to calculate intermediate results for SQL statements, thus reducing TiDB's computation and network overhead. This is the task that Coprocessor executes in most scenarios, and the currently pushed physical operators include: TableScan, IndexScan, Selection, Limit, TopN, Aggregation, etc.

- Analyze the table data, count and sample the table data information, and persist it to be adopted by TiDB's optimizer.

- Checksum: Verifying the table data for consistency check after data import.

