mysql - 在 Spring Boot 和 Hibernate 应用程序中使用 XtraDB 作为存储引擎

标签 mysql spring hibernate spring-boot mariadb

我正在开发一个使用 Spring Boot 2.0.3、Hibernate 5.2.17 和 MariaDB 10.1.29 的项目。我试图在 hibernate 生成表时将存储引擎设置为 XtraDB,但没有成功。

这是我的 application.properties 文件:

spring.thymeleaf.cache=false

spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.url=jdbc:mariadb://localhost:3306/bookstore-db
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=****
spring.datasource.hikari.connection-timeout=20000
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=12
spring.datasource.hikari.idle-timeout=300000
spring.datasource.hikari.max-lifetime=1200000
spring.datasource.hikari.auto-commit=true

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDB53Dialect
spring.jpa.properties.hibernate.dialect.storage_engine=xtradb

spring.jpa.hibernate.ddl-auto=update

即使指定了 spring.jpa.properties.hibernate.dialect.storage_engine=xtradb 它仍然使用 InnoDB,如控制台所示:

create table hibernate_sequence (
   next_val bigint
) engine=InnoDB
Hibernate: 

insert into hibernate_sequence values ( 1 )
Hibernate: 

create table user (
   id_user bigint not null,
    email varchar(255) not null,
    enabled bit not null,
    first_name varchar(255),
    last_name varchar(255),
    password varchar(255),
    phone varchar(255),
    username varchar(255),
    primary key (id_user)
) engine=InnoDB

感谢您的帮助。

最佳答案

嗯,自 MariaDB 10.2 以来,InnoDB 被用作默认和最佳选择。这些是他们的 site 上提到的原因

XtraDB had many great improvements over InnoDB in 5.1 and 5.5. But over time, MySQL has implemented almost all of them. InnoDB has caught up and XtraDB is only marginally better...

In particular, the only real improvement that XtraDB 5.7 seems to have is for a write-intensive I/O-bound workload, where innodb_thread_concurrency control is disabled.

因此,对于那些使用最新版本的 MariaDB 的人来说,没有更多理由切换到 XtraDB。

关于mysql - 在 Spring Boot 和 Hibernate 应用程序中使用 XtraDB 作为存储引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51525275/

相关文章:

mysql - 表创建 - 外键约束格式不正确

php - Codeigniter 中的多步骤形式?

spring - 如何在 Spring 3.0.x 中正确测试@Async 邮件程序?

java - 仅为实体组配置 Hibernate 实体监听器

PHP 获取两行但仅从最后一行上传文件

php - 为什么当我尝试在 Web 服务器上写入一些数据时 AsyncTask 运行两次?

spring - 在类路径资源...中定义的bean 'hibernateSearchService' 无法注册

java - 使用带有嵌入式 Jetty 的 Spring-Boot 在 Camel rest-component 上配置 SSL

java - hibernate 多对多关联不更新连接表

hibernate - 使用 hibernate 注释进行软删除时出错