JackyYangPassion opened a new issue, #2674: URL: https://github.com/apache/incubator-hugegraph/issues/2674
### Bug Type (问题类型) None ### Before submit - [X] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 [FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents) ### Environment (环境信息) - Server Version: master - Backend: HBase/HStore - OS: CentOS 7.x ### Expected & Actual behavior (期望与实际表现) # Motivation 在时机使用中,发现批量点查性能差,无法满足业务需求 提升批量查询性能 # Example 查询语句 g.V('id1','id2','id3') 当前版本问题 时间复杂度为O(n), 当使用RPC查询后端,性能很差,常规优化手法是批量查询下发存储层 # Optimization plan 此处直接调用query.query(ids) TODO: 待提交PR ``` protected Iterator<Vertex> queryVerticesByIds(Object[] vertexIds, boolean adjacentVertex, boolean checkMustExist, HugeType type) { Query.checkForceCapacity(vertexIds.length); // NOTE: allowed duplicated vertices if query by duplicated ids List<Id> ids = InsertionOrderUtil.newList(); Map<Id, HugeVertex> vertices = new HashMap<>(vertexIds.length); IdQuery query = new IdQuery(type); for (Object vertexId : vertexIds) { HugeVertex vertex; Id id = HugeVertex.getIdValue(vertexId); if (id == null || this.removedVertices.containsKey(id)) { // The record has been deleted continue; } else if ((vertex = this.addedVertices.get(id)) != null || (vertex = this.updatedVertices.get(id)) != null) { if (vertex.expired()) { continue; } // Found from local tx vertices.put(vertex.id(), vertex); } else { // Prepare to query from backend store query.query(id); } ids.add(id); } if (!query.empty()) { // Query from backend store query.mustSortByInput(false); Iterator<HugeVertex> it = this.queryVerticesFromBackend(query); QueryResults.fillMap(it, vertices); } return new MapperIterator<>(ids.iterator(), id -> { HugeVertex vertex = vertices.get(id); if (vertex == null) { if (checkMustExist) { throw new NotFoundException( "Vertex '%s' does not exist", id); } else if (adjacentVertex) { assert !checkMustExist; // Return undefined if adjacentVertex but !checkMustExist vertex = HugeVertex.undefined(this.graph(), id); } else { // Return null assert vertex == null; } } return vertex; }); } ``` ### Vertex/Edge example (问题点 / 边数据举例) _No response_ ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构) _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hugegraph.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org