PolarDB-X怎么加索引也报错?

PolarDB-X怎么加索引也报错?

3 sql运行异常
### Error updating database.  Cause: java.sql.SQLException: [16df64f733001000-2][172.17.0.8:53837][hospital]ERR-CODE: [PXC-4998][ERR_NOT_SUPPORT] Multi alter specifications when create GSI not support yet!
### The error may exist in com/jy/starter/flyway/mapper/FlyMapper.java (best guess)
### The error may involve com.jy.starter.flyway.mapper.FlyMapper.excute-Inline
### The error occurred while setting parameters
### SQL: alter table `keshi_info`add index `index_hospitalId` (`hospital_id`) ,add index `index_guobiaoksdm` (`guoBiaoDM`)
### Cause: java.sql.SQLException: [16df64f733001000-2][172.17.0.8:53837][hospital]ERR-CODE: [PXC-4998][ERR_NOT_SUPPORT] Multi alter specifications when create GSI not support yet!
; uncategorized SQLException; SQL state [HY000]; error code [4998]; [16df64f733001000-2][172.17.0.8:53837][hospital]ERR-CODE: [PXC-4998][ERR_NOT_SUPPORT] Multi alter specifications when create GSI not support yet! ; nested exception is java.sql.SQLException: [16df64f733001000-2][172.17.0.8:53837][hospital]ERR-CODE: [PXC-4998][ERR_NOT_SUPPORT] Multi alter specifications when create GSI not support yet!

iwEcAqNwbmcDAQTRCbQF0QRSBrDfEj3furatzQUWmV1VwCEAB9IEfpPLCAAJomltCgAL0gAHaT0.png_720x720q90.jpg

展开
收起
青城山下庄文杰 2023-10-17 17:46:17 261 分享 版权
1 条回答
写回答
取消 提交回答
  • 公众号:网络技术联盟站,InfoQ签约作者,阿里云社区签约作者,华为云 云享专家,BOSS直聘 创作王者,腾讯课堂创作领航员,博客+论坛:https://www.wljslmz.cn,工程师导航:https://www.wljslmz.com

    根据您提供的错误信息,问题出在尝试使用多个ALTER TABLE语句来创建索引时。目前,PolarDB-X尚不支持同时创建多个索引。

    要解决这个问题,您可以将多个ALTER TABLE语句合并为一个,如下所示:

    ALTER TABLE `keshi_info`
    ADD INDEX `index_hospitalId` (`hospital_id`),
    ADD INDEX `index_guobiaoksdm` (`guoBiaoDM`);
    

    这样,您就可以在一个语句中创建两个索引,而不会出现错误。

    2023-10-17 18:54:11
    赞同 1 展开评论

PolarDB 分布式版 (PolarDB for Xscale,简称“PolarDB-X”) 采用 Shared-nothing 与存储计算分离架构,支持水平扩展、分布式事务、混合负载等能力,100%兼容MySQL。 2021年开源,开源历程及更多信息访问:OpenPolarDB.com/about

还有其他疑问?
咨询AI助理