You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OrientDB中Index(索引)与Automatic Index(自动索引)的区别

Key Differences Between Index and Automatic Index in OrientDB

Great question—these two terms aren’t interchangeable, and understanding their differences will help you manage your OrientDB database more effectively. Let’s break them down:

1. Regular (Manual) Index

  • Created by you, explicitly: You have to run a command like CREATE INDEX user_name_idx ON User (name) NOTUNIQUE to set it up. No automatic creation here.
  • No automatic binding to properties: Unless you explicitly link it to a class property, the index won’t update when you modify records. If you do link it, you still might need to manually rebuild it if you make schema changes later.
  • Full control over use cases: Perfect when you want to optimize specific queries (like frequent lookups on a non-unique property) or use custom index types (full-text, geospatial, etc.). You decide when to create, update, or delete it.

2. Automatic Index

  • Auto-created by OrientDB: This index pops up automatically when you add constraints like UNIQUE, UNIQUE_HASH_INDEX, or NOTNULL to a class property. For example, if you run ALTER PROPERTY User.email SET UNIQUE, OrientDB will create an automatic index for User.email.
  • Fully maintained by the database: Any time you insert, update, or delete a record with that property, OrientDB syncs the index automatically—no manual work needed from you.
  • Tied directly to the constrained property: The index is named after the class and property (e.g., User.email) and can’t be easily repurposed for other properties. Its main job is to enforce the constraint (like ensuring no duplicate emails) while also speeding up queries on that property.

Quick Cheat Sheet for Comparison

AspectRegular IndexAutomatic Index
Creation MethodManual CREATE INDEX commandTriggered by adding property constraints
MaintenanceManual (or custom triggers)Fully automatic by OrientDB
Property BindingOptional, manual setupAutomatic, tied to the constrained property
Primary GoalQuery optimization, custom indexingData integrity enforcement + automatic query speedup

If you’re ever unsure which one you’re looking at, check the index name and how it was created—automatic indexes almost always follow the ClassName.PropertyName naming pattern.

内容的提问来源于stack exchange,提问作者Rohan Shelar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 09:07:22