# ShardingSphere

![整体结构图](https://2351062869-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7b2CdwBN9liniVJpfEAc%2Fuploads%2Fgit-blob-5208ac2f8cb8932b9382b5bf1e95a3ce0e3375a9%2F20240310094259.png?alt=media)

![设计哲学](https://2351062869-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7b2CdwBN9liniVJpfEAc%2Fuploads%2Fgit-blob-e22793859b192b3416f63983151b9bbea20b66aa%2F20240310094110.png?alt=media)

## ShardingJDBC

### ShardingJDBC有哪些主要的功能？

* 数据分片
* 读写分离
* 分布式主键
* 分布式事务
* 数据库治理
  * 配置动态化
  * 编排治理
  * 数据脱敏
  * 可视化链路追踪

### ShardingJDBC中的基本概念

* 表概念：
  * 逻辑表：`t_order`表本身不存在，但是有`t_order_n`多张真实表
  * 真实表：真实存在的物理表，比如 `t_order_0 ... 1 ...`
  * 数据节点：在分片后，由数据源和数据表组成，比如 `order_db.t_order_1`
  * 绑定表：分片规则一致的关系表，比如表`t_order` 与 `t_order_item` 均使用 `order_id` 分片，他们就是绑定表，如果配置了绑定表，那么数据绑定表的数据一定会在一个库中，可以直接从一个库中查询
  * 广播表：没有必要做分片的表，比如字典表、省份信息。广播表会在每个节点存储一份，存储内容和结构完全相同。
  * 单表：所有分片数据源中只存在唯一一张表，适合数据量不大不需要分片的操作场景。
* 分片键：用于分片的数据库字段，是表水平拆分的关键字段
* 分片算法：用于分片的数据库字段，是表水平拆分的关键字段
* 分片策略 = 分片键+分片算法：
  * 不分片策略
  * 标准分片策略
  * 复合分片策略
  * 行表达式分片策略
  * Hint分片策略


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yangsx95.gitbook.io/notes/distributed/shu-ju-ku-zhong-jian-jian/shardingsphere.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
