美文网首页
解决JPA 每次启动删除索引创建索引

解决JPA 每次启动删除索引创建索引

作者: 大继 | 来源:发表于2019-06-21 19:22 被阅读0次

    问题描述

    每次启动,都自动删除索引创建索引,如果数据大了启动会卡死

    Hibernate: alter table cent_subject_rate drop index UKq0bb2hiln5dlv7pxtx998d2ec
    Hibernate: alter table cent_subject_rate add constraint UKq0bb2hiln5dlv7pxtx998d2ec unique (subject)
    Hibernate: alter table resource drop index UKofk8xvjky9ywulks6j96gieec
    Hibernate: alter table resource add constraint UKofk8xvjky9ywulks6j96gieec unique (url, method)
    Hibernate: alter table sms_phone_numbers_validate_daily_statistic drop index UK4oek3chy167t2u1j8xcrywqne
    Hibernate: alter table sms_phone_numbers_validate_daily_statistic add constraint UK4oek3chy167t2u1j8xcrywqne unique (day, phone_numbers)
    Hibernate: alter table user_message_format drop index UKdnx02we4jsxakvd4yy8xv4tw0
    Hibernate: alter table user_message_format add constraint UKdnx02we4jsxakvd4yy8xv4tw0 unique (name)
    

    排查问题

    image.png

    各种查询之后发现
    MySQL索引varchar长度问题(不能超过255)
    特别是在UTF8 下面长度更低。

    更刺激的是,阿里云的RDS 最大长度只能是 767 byte 也就 100 来个 varchat 长度

    相关文章

      网友评论

          本文标题:解决JPA 每次启动删除索引创建索引

          本文链接:https://www.haomeiwen.com/subject/foduxctx.html