diff --git a/README.md b/README.md index 0a605cc..e07e542 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ English | [简体中文](./README.zh-CN.md) -Gorm Plugin for sharding table. +Gorm Sharding splits large tables into smaller ones to speed up access. -This plugin base on SQL Parser, catch raw SQL before execute db, and then replace table name by sharding rules. +Assume we have an order table with 100 million rows, we can divide it into 1000 smaller ones, so the read and write operation will faster than operate the original table. + +![Example Scenario](./images/example-scenario.svg) ## Features diff --git a/README.zh-CN.md b/README.zh-CN.md index 3565a66..c483246 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,8 +1,12 @@ # Gorm Sharding -Gorm 分表插件。 +[English](./README.md) | 简体中文 -基于 SQL 解析器,执行前捕获原始 SQL,根据分表规则替换表名。 +Gorm Sharding 将大表拆分成多个小表来加速访问。 + +假设有一个一亿行的订单表,我们可以将它拆分成一千个小表,这样读写操作就会比操作原始表快很多。 + +![场景示例](./images/example-scenario.svg) ## 特色 diff --git a/images/example-scenario.drawio b/images/example-scenario.drawio new file mode 100644 index 0000000..b113d78 --- /dev/null +++ b/images/example-scenario.drawio @@ -0,0 +1 @@ +7Vpdb5swFP01eZnUyAYCyWOXdp32IbXLw7qnyg0OsBlMjfO1Xz8b7AAhiUgbIGpGpBJfXxvjc869dtyeOQ5XdwzF/nfqYtIzgLvqmTc9w4CWYYubtKwziwOVwWOBq5xywyT4i5URKOs8cHFScuSUEh7EZeOURhGe8pINMUaXZbcZJeWnxsjDFcNkikjV+jNwuZ9Zh4aT2z/jwPP1k6E9ympCpJ3VmyQ+cumyYDJve+aYUcqzb+FqjImcPD0vWbtPe2o3A2M44nUauI8/XujT08sX7thfYz55AIuHK93NApG5emM1Wr7WU4BdMSOqSBn3qUcjRG5z60dG55GL5XOAKOU+3yiNhREK42/M+VrBi+acCpPPQ6JqZzTiqhJaqjymhLJ0BOYQyI+wZ2OTA9o7CcqU0Dmb4kNvrsiEmIf5AT9rA5XgOKYh5mwt2jFMEA8W5XEgRTZv46eaXjOG1gWHmAYRTwo930uDcFC6GdiKNEo1cLiF7XH+4ks2Al0qvEpuSvlyDHesV1ClQXLgVcAfJQf7EAxU+Zds1AfQVOWblSJpWlgXCveYBWJGMFO2hDP6BxeeA9KrwvYOKGm+kZIFWrwC9R0BwyZc4VKig/0yp7riKkkRvBYOcBiv8so0dutJzo3mLL2KJtuT9wQTGecN8EGGc0ZDcaPMxUzICSx9zLC4i6Qh/qZdAihAUyMUL5wNMuuqQt8cWcm7pR9wPIlRitlSpLctWgaEFOhhAzSCToU4EY1wlbPq5fQQFphxvDrMnyreqoFVlr5SPljm2crR0cEvZCrtd3qCmJeaUsya+h10qd9d6BypX7usXy2mUi9HaVrr10ahFFn0nMRZZNCdPjPtCoG65ITJ1V2l0R6pNx8BZgCZANWMAJtscvoIYIFqCICthgA4utQQYNUMAU6XIcDqOIXfUSaz9sRHzA0irw1twmcEsdFBdjaNsjg3Yi2I0xq2Kc7BydFXCzMidreSwsmcyL1N86DiAbRAda3ePKhbu63N7qsYcI02MbXfjqm5C9MsMT9l6fY0XcKt7L0nW9dL6u8xQuxK360GCJ2sLy97OzWzNwS7EW0nfTvNih2WxJ6vvJuR/7ks3juT/+Dc5D9sll6j0aixXHLxZHLOjUz6GOfkq80ZSni7q00AhqiT1eYAnNtyE+7/ESmJUVQLVWsXqv1+vwBl1td70qdV46caq1Uk9+8G/yN5cAt4bkjqg/Z2F+n5mVvpxK136LTtjA97jWbW9aKYn/Nnx6/5f0uYt/8A \ No newline at end of file diff --git a/images/example-scenario.svg b/images/example-scenario.svg new file mode 100644 index 0000000..83ebe74 --- /dev/null +++ b/images/example-scenario.svg @@ -0,0 +1,3 @@ + + +
select * from orders where uid = 100
select * from orders where uid = 100
orders 
100000000 rows 
orders...
Gorm Sharding
Gorm Sharding
slow results
slow results
orders_000 100000 rows 
orders_000 10...
orders_100
100000 rows 
orders_100...
orders_999 100000 rows 
orders_999 10...
fast results
fast results
...
...
...
...
Text is not SVG - cannot display
\ No newline at end of file diff --git a/keygen/README.md b/keygen/README.md index fd2d70b..adf3273 100644 --- a/keygen/README.md +++ b/keygen/README.md @@ -1,3 +1,5 @@ # keygen +English | [简体中文](./README.zh-CN.md) + Distributed Primary Key generator. diff --git a/keygen/README.zh-CN.md b/keygen/README.zh-CN.md new file mode 100644 index 0000000..4a3315b --- /dev/null +++ b/keygen/README.zh-CN.md @@ -0,0 +1,5 @@ +# keygen + +[English](./README.md) | 简体中文 + +分布式主键生成器。 diff --git a/keygen/README_zh.md b/keygen/README_zh.md deleted file mode 100644 index 7ccb4cf..0000000 --- a/keygen/README_zh.md +++ /dev/null @@ -1,3 +0,0 @@ -# keygen - -分布式主键生成器。