shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

During scaling, the index in the statement generating the table exceeds the length limit.

Open VeejaLiu opened this issue 4 years ago • 13 comments

Bug Report

image

VeejaLiu avatar Apr 25 '22 01:04 VeejaLiu

The create table SQL is generated and rewritten by kernel.

sandynz avatar Apr 25 '22 03:04 sandynz

@sandynz I think we should deal with such corner cases, I think this is a bug.

VeejaLiu avatar Apr 25 '22 06:04 VeejaLiu

Hi @strongduanmu , could you help to have a look at this issue?

sandynz avatar Apr 26 '22 13:04 sandynz

@sandynz Thank you for your remind. @VeejaLiu This is not a bug, the logical index will add the actual table suffix in ShardingSphere. I think you should adjust the length of the logic logical index to avoid the actual index being too long.

strongduanmu avatar Apr 27 '22 00:04 strongduanmu

@strongduanmu Thank you for your reply. But I don't agree with you. In the production environment, it's normal to have a long table name or index name. Even because of some historical factors, this bad design may already exist in the user's system. But we can't blame our users for this. I think as middleware developers, we should achieve maximum compatibility and non-invasive. We should predict this situation in advance and take corresponding actions, rather than let users modify their design (even bad design). Finally, thank you for your reply.

VeejaLiu avatar Apr 27 '22 03:04 VeejaLiu

@VeejaLiu Of course, I agree that ShardingSphere should be as compatible with native databases as possible, but ShardingSphere needs to consider different databases, and indexes with the same name are not allowed in PostgreSQL databases, which is the reason for index rewriting.

If you are interested, you can try to sort out the index requirements of different databases, and then optimize the logic of existing index rewriting.

strongduanmu avatar Apr 27 '22 03:04 strongduanmu

@strongduanmu Thank you! It explains the matter I've only used MySQL and haven't thought about other databases. This is really a thorny problem. Thank you for your reply.

VeejaLiu avatar Apr 27 '22 03:04 VeejaLiu

Is the problem resolved?

terrymanu avatar Jun 24 '22 16:06 terrymanu

@terrymanu I didn't solve the problem. I just shorten the length of the index to suit you. Your side... I don't know.

VeejaLiu avatar Jun 24 '22 16:06 VeejaLiu

Hello , this issue has not received a reply for several days. This issue is supposed to be closed.

github-actions[bot] avatar Oct 08 '22 16:10 github-actions[bot]

最终这个问题不解决了吗?

ayundi123 avatar Feb 21 '24 09:02 ayundi123

hhhh, still in status: volunteer wanted

VeejaLiu avatar Feb 21 '24 10:02 VeejaLiu

image 1708591760943 mysql索引超长的问题可以通过修改这行代码解决。

ayundi123 avatar Feb 22 '24 08:02 ayundi123

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

github-actions[bot] avatar Mar 28 '24 20:03 github-actions[bot]