Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 有没有办法在SpringBoot中使用实际的SQL查询(使用MySql中的Performance_模式)?_Java_Mysql_Spring_Spring Boot_Spring Data Jpa - Fatal编程技术网

Java 有没有办法在SpringBoot中使用实际的SQL查询(使用MySql中的Performance_模式)?

Java 有没有办法在SpringBoot中使用实际的SQL查询(使用MySql中的Performance_模式)?,java,mysql,spring,spring-boot,spring-data-jpa,Java,Mysql,Spring,Spring Boot,Spring Data Jpa,我在春季和春季是新手。 我来这里是因为我找不到一种方法来使用Spring在查询本地MysqlDB时使用性能模式 我尝试使用@Query anotion,但发现它使用的是JPQL 我的问题 SELECT EVENT_ID, TRUNCATE(TIMER_WAIT / 1000000000000, 6) AS Duration, SQL_TEXT FROM performance_schema.events_statements_history_long WHERE (TR

我在春季和春季是新手。 我来这里是因为我找不到一种方法来使用Spring在查询本地MysqlDB时使用性能模式

我尝试使用@Query anotion,但发现它使用的是JPQL

我的问题

    SELECT EVENT_ID, TRUNCATE(TIMER_WAIT / 1000000000000, 6) AS Duration, SQL_TEXT 
    FROM performance_schema.events_statements_history_long
    WHERE (TRUNCATE(TIMER_WAIT / 1000000000000, 6)) > 0.002;
(请忽略这个糟糕的查询,我只想表明我想要使用性能\架构表) 我看到的是,我应该使用JPQL进行查询,但如果性能模式是“隐藏”的,我看不出我如何做到这一点

我试图在数据库中获取有关查询的信息,通常进行监视。这就是我使用性能模式的原因

我很想知道如何传递这个查询,或者是否有其他方法从我的数据库获取此类信息(不仅仅是这个查询,这是我将要做的一个示例)

另外,为什么关于性能模式的信息如此之少。这不好吗?还有别的工具我找不到吗


谢谢大家

这里没有关于查询的信息 数据库本身使用此结构来优化查询(通常)

  • MySQL的旧版本没有
    性能模式
    。你用的是什么版本
  • TRUNCATE()
    ??也许你的意思是
    FLOOR()
    ROUND()
  • 另见

    EXPLAIN SELECT ...
    EXPLAIN FORMAT=JSON SELECT ...
    the slowlog -- turn on and have `long_query_time = 1`.
    

我的查询在MySql工作台上运行良好。它给了我所需要的信息。也许我的帖子不清楚。我想使用SpringBoot来使用该查询,但我找不到使用“原始”SQL从MySql获取性能详细信息(即执行时间)的方法