나는 neo4j 및 스프링 데이터를 사용하여 백만 개의 개체에 페이지 매김을 시도합니다. 내 프로그램은 두 개의 쿼리를 실행합니다 : 첫 번째 일치하는 데이터. 두 번째는 내 제한 사항과 일치하는 모든 요소를 계산합니다. 그러나 마지막 쿼리는 많은 시간이 걸립니다.쿼리가 너무 오래 걸리며
가@Autowired
Neo4jOperations template;`
StringBuilder query = new StringBuilder(" match (n:Domain) where n.isPrincipale={isPrincipale} ");
mapOfVars.put("isPrincipale", true);
if (request.getParameterMap().containsKey("mydom")
&& !request.getParameter("mydom").isEmpty()) {
query.append(" and n.domain =~ {mydom}");
mapOfVars.put("mydom",".*(?i)"+request.getParameter("mydom")+".*");
}
probleme은 여기 :
iTotalRecords = Integer.valueOf((template.query(query.toString() + " return count(n) as count", mapOfVars)).queryResults().iterator().next().get("count").toString());
난 매칭 결과를 얻을 계산 후 :
query.append("
return n.domain as domain, n.hasDmarc as dmarc ,
n.spf_action as spf, n.updatedAt as updatedAt ,
n.existValue as exst , id(n) as id
skip {start} limit {displayCount}");
mapOfVars.put("start", iDisplayStart);
mapOfVars.put("displayCount", iDisplayCount);
Iterable<Map<String, Object>> domains = template.query(query.toString(), mapOfVars);
자세한 내용을 공유하십시오. 그렇지 않으면 도움을받을 수 없습니다. 빠른 계산을위한 방법이 있지만 세부 정보를 제공하지 않고 ... –
편집 된 게시물을 확인하십시오. –