try(ResultSetresultSet=h2Client.executeQuery(connection,"select * from "+SegmentRecord.INDEX_NAME+" where "+SegmentRecord.SEGMENT_ID+" = ?",segmentId)){
sql.append("select ").append(aggType).append("(").append(ProfileThreadSnapshotRecord.SEQUENCE).append(") from ").append(ProfileThreadSnapshotRecord.INDEX_NAME).append(" where ");