dosubot[bot] commented on issue #2776: URL: https://github.com/apache/incubator-hugegraph/issues/2776#issuecomment-2911747361
<!-- Answer --> HugeGraph 在顶点 ID 策略为 PrimaryKey(PRIMARY_KEY)时,如果插入两条 primaryKey 值完全相同的数据,系统会自动进行“去重/覆盖”处理: - **同一个 VertexLabel 下,primaryKey 组合值相同的顶点,只能有一条。** - 如果你插入一条 primaryKey 已存在的顶点数据,HugeGraph 会直接覆盖原有顶点(即后插入的会替换前面的),不会报错,也不会新增一条重复数据。 这种行为适合大批量导入或幂等写入场景,用户无需手动查重,HugeGraph 会自动保证 primaryKey 唯一性,实现“以主键为准,后写覆盖前写”[相关文档说明](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/cn/docs/guides/desgin-concept.md)。 **补充说明:** - 如果你希望插入时能感知是否发生了覆盖(比如需要提示),可以考虑用 AUTOMATIC 策略(但性能不如 PRIMARY_KEY)。 - 如果用 CUSTOMIZE_STRING 或 CUSTOMIZE_NUMBER 策略,则需要你自己保证 ID 唯一性,系统不会自动查重。 如需具体代码示例或批量导入配置,可以继续补充需求。 <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/20138b4e-fa4c-45e1-bfa9-a1b71b5e52d2?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2776) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
