io.ebean.Query.setBufferFetchSizeHint()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中io.ebean.Query.setBufferFetchSizeHint方法的一些代码示例,展示了Query.setBufferFetchSizeHint的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setBufferFetchSizeHint方法的具体详情如下:
包路径:io.ebean.Query
类名称:Query
方法名:setBufferFetchSizeHint

Query.setBufferFetchSizeHint介绍

[英]A hint which for JDBC translates to the Statement.fetchSize().

Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for ResultSet.

Note that internally findEach and findEachWhile will set the fetch size if it has not already as these queries expect to process a lot of rows. If we didn't then Postgres and MySql for example would eagerly pull back all the row data and potentially consume a lot of memory in the process.

As findEach and findEachWhile automatically set the fetch size we don't have to do so generally but we might still wish to for tuning a specific use case.
[中]对于JDBC,这是一个转换为语句的提示。fetchSize()。
当ResultSet需要更多行时,向JDBC驱动程序提示应该从数据库中获取的行数。
请注意,如果findEach和findEachWhile还没有设置取数大小,那么它们会在内部设置取数大小,因为这些查询预期会处理很多行。如果我们不这样做,例如Postgres和MySql将急切地收回所有行数据,并可能在这个过程中消耗大量内存。
由于findEach和findEachWhile会自动设置获取大小,我们通常不必这样做,但我们可能仍然希望调整特定的用例。

代码示例

代码示例来源:origin: org.actframework/act-ebean

@Override
public EbeanQuery<MODEL_TYPE> setBufferFetchSizeHint(int fetchSize) {
  q.setBufferFetchSizeHint(fetchSize);
  qReadOnly.setBufferFetchSizeHint(fetchSize);
  return this;
}

代码示例来源:origin: io.ebean/ebean-querybean

/**
 * A hint which for JDBC translates to the Statement.fetchSize().
 * <p>
 * Gives the JDBC driver a hint as to the number of rows that should be
 * fetched from the database when more rows are needed for ResultSet.
 * </p>
 */
public R setBufferFetchSizeHint(int fetchSize) {
 query.setBufferFetchSizeHint(fetchSize);
 return root;
}

代码示例来源:origin: org.actframework/act-ebean2

@Override
public EbeanQuery<MODEL_TYPE> setBufferFetchSizeHint(int fetchSize) {
  q.setBufferFetchSizeHint(fetchSize);
  return this;
}

代码示例来源:origin: icode/ameba

/**
 * {@inheritDoc}
 * Sets a hint, which for JDBC translates to <code>Statement.fetchSize()</code>.
 */
public Query<T> setBufferFetchSizeHint(int fetchSize) {
  return query().setBufferFetchSizeHint(fetchSize);
}

相关文章

Query类方法