A new generation of domestic ORM framework sagacity-sqltoy-5.2.3 release

Open source address:

update content

1. Add OverTimeSqlHandler to provide the collection of time-out execution sql

SqlToyLazyDao.getSqlToyContext().getSlowestSql(10,true);


2. Fixed the problem of reporting NPE when the associated field value of loadAll cascaded loading is null

# 设置超时sql的处理类,默认为org.sagacity.sqltoy.plugins.overtime.DefaultOverTimeHandler
# 设置sql执行超时阀值:默认值30000(30秒)
spring.sqltoy.printSqlTimeoutMillis=10000
spring.sqltoy.overTimeSqlHandler

在SqlToyContext中提供了获取慢sql的方法
/**
 * @TODO 获取执行最慢的sql
 * @param size     提取记录数量
 * @param hasSqlId 是否是xml中定义id的sql
 * @return
 */
public List<OverTimeSql> getSlowestSql(int size, boolean hasSqlId) {
    return overTimeSqlHandler.getSlowest(size, hasSqlId);
}

Thanks: feedback from netizens Junhua and non-famous professional bug writers

​​​Key advantages of sqltoy

//------------------了解 sqltoy的关键优势: -------------------------------------------------------------------------------------------*/
//1、最简最直观的sql编写方式(不仅仅是查询语句),采用条件参数前置处理规整法,让sql语句部分跟客户端保持高度一致
//2、sql中支持注释(规避了对hint特性的影响,知道hint吗?搜oracle hint),和动态更新加载,便于开发和后期维护整个过程的管理
//3、支持缓存翻译和反向缓存条件检索(通过缓存将名称匹配成精确的key),实现sql简化和性能大幅提升
//4、支持快速分页和分页优化功能,实现分页最高级别的优化,同时还考虑到了cte多个with as情况下的优化支持
//5、支持并行查询
//6、根本杜绝sql注入问题
//7、支持行列转换、分组汇总求平均、同比环比计算,在于用算法解决复杂sql,同时也解决了sql跨数据库问题
//8、支持保留字自动适配
//9、支持跨数据库函数自适配,从而非常有利于一套代码适应多种数据库便于产品化,比如oracle的nvl,当sql在mysql环境执行时自动替换为ifnull
//10、支持分库分表
//11、提供了取top、取random记录、树形表结构构造和递归查询支持、updateFetch单次交互完成修改和查询等实用的功能
//12、sqltoy的update、save、saveAll、load 等crud操作规避了jpa的缺陷,参见update(entity,String...forceUpdateProps)和updateFetch
//13、提供了极为人性化的条件处理:排它性条件、日期条件加减和提取月末月初处理等
//14、提供了查询结果日期、数字格式化、安全脱敏处理,让复杂的事情变得简单,大幅简化sql或结果的二次处理工作
//-----------------------------------------------------------------------------------*/

sqltoy features introduction:

  • The core construction idea of ​​sqltoy

  • The core points of sqltoy comparison mybatis (plus): query statement writing, readability, maintainability

  • Object crud is the foundation, but sqltoy has targeted improvements: update, updateSaveFetch, updateFetch, etc.

  • sqltoy's cache translation greatly reduces table associations and simplifies sql, making your query performance geometrically improved

Explain why sqltoy kills mybatis (plus) in seconds

  • The ultimate paging also helps you achieve a significant increase in query performance
  1. Fast paging: @fast () realizes first fetching a single page of data and then correlates the query, which greatly improves the speed
  2. Paging optimizer: page-optimize makes paging query from two times to 1.3~1.5 times (the total number of records that use the cache to achieve the same query condition does not need to repeat the query within a certain period
  3. The process of sqltoy's paging and fetching total records is not a simple select count (1) from (original sql); it is an intelligent judgment whether it becomes: select count (1) from 'from after statement', and automatically removes the outermost order by
  4. sqltoy supports parallel query: parallel="true", query the total number of records and single page data at the same time, greatly improving performance
Explain why sqltoy kills mybatis (plus) in seconds
 
  • Convenient Cross-Database Statistical Calculations: Data Rotation
Explain why sqltoy kills mybatis (plus) in seconds
  • Convenient cross-database statistical calculation: infinite grouping statistics (including summary averaging)
Explain why sqltoy kills mybatis (plus) in seconds
  • Convenient cross-database statistical calculation: year-on-year
Explain why sqltoy kills mybatis (plus) in seconds

 

 

Guess you like

Origin www.oschina.net/news/202287