How to Ensure Different Table Partitions are Located on the Same Node When Creating Tables

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何在创建表时让不同的表分区落在相同的节点上

| username: llllllll

Currently, there is a table t1 with data hashed into 4 partitions: p11, p12, p13, p14. At the same time, a new table t2 is created and also hashed into 4 partitions: p21, p22, p23, p24. How can we ensure that p11, p12, p13, p14 and p21, p22, p23, p24 are on the same nodes by specifying it explicitly?

| username: wink | Original post link

Refer to the Placement Rules feature: Placement Rules 使用文档 | PingCAP 文档中心

Here is the practice of NetEase Games: 专栏 - TiDB 冷热存储分离解决方案 | TiDB 社区

| username: llllllll | Original post link

May I ask again, in the case of multiple TiFlash instances and a table with multiple partitions, if you set only one replica through set tiflash replica 1, will the multiple partitions be deployed on the same TiFlash node or is it possible for them to be deployed on multiple TiFlash nodes?

| username: wink | Original post link

If no placement rules are specified, multiple partitions should not be placed on the same node. This is because partitions are considered independent within TiDB.

| username: wish-PingCAP | Original post link

If no Placement Rule is specified and each partition has at least 100MB of data, the data within each partition will be evenly distributed across the TiFlash nodes (i.e., a single TiFlash node will contain a portion of the data from each partition).

| username: llllllll | Original post link

Could you provide an example of a placement rule specifying which TiFlash node a partition should be placed on?

| username: wish-PingCAP | Original post link

You can refer to this document: Placement Rules in SQL | PingCAP 文档中心

| username: flow-PingCAP | Original post link

However, placement rules in SQL currently do not support TiFlash. Support for TiFlash will start from version 6.3. So it’s not very useful at the moment. Orz

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.