# Distributed  SQL Operations

__*Distributed SQL*__

![right](./student-guide/diagram/tidb-computing-dist-sql-flow.drawio.png)

+ distributed **SQL**  vs. **TiKV** 

```12
tidb> SELECT ~!@COUNT(*)@!~ FROM universe.planets
   -> WHERE category_id = 1;
```
-------------------------------------------------------------
To keep the compute as close to the storage node as possible to avoid a large number of RPC calls. First, the predicate condition name = "TiDB" in SQL should be pushed down to the storage node for computation, so that only valid row are return and meaningless network transfers are avoided. The aggregate functionCount(*)  can then also be pushed down to the storage nodes for preaggregation, and each node only needs to return oneCount(*)  The results are sufficient, and the results return by each node areCount(*)  summed up by the SQL layer.

