slim3で1000件以上のレコード件数を取得する方法
404 shin1のつぶやき ないわー Not Found: #appengine でクエリの結果件数を取得する方法(1000件超とか)の情報を元にDaoクラスに下記関数を追加した。
public int countAll() { Query query = this.pm.newQuery(this.modelClass); query.setResult("key"); int count = ((List)query.execute()).size(); query.closeAll(); return count; }
遅いけど、1000件以上でも取得できました。私の環境でかかった時間は下記。
- 1303件 1502ミリ秒
- 1050件 2263ミリ秒
- 1050件 920ミリ秒
- 1050件 1225ミリ秒
- 1050件 958ミリ秒