Ich arbeite mit OrientDB Enterprise Server v2.1.13 und hatte einige Probleme, für die ich noch keine Erklärung und Lösung finden kann.OrientDB - fehlende Werte im automatischen SB-Tree-Index
Es scheint, dass automatische zusammengesetzte SB-Tree-Index nicht ordnungsgemäß funktioniert und neue Werte nicht indiziert (oder ich etwas falsch verstehe). A haben folgende Randklassen:
CREATE CLASS ACTION EXTENDS E CLUSTERS 0 ABSTRACT
CREATE PROPERTY ACTION.out LINK
ALTER PROPERTY ACTION.out MANDATORY true
ALTER PROPERTY ACTION.out NOTNULL true
CREATE PROPERTY ACTION.in LINK
ALTER PROPERTY ACTION.in MANDATORY true
ALTER PROPERTY ACTION.in NOTNULL true
CREATE PROPERTY ACTION.action STRING
ALTER PROPERTY ACTION.action MANDATORY true
CREATE PROPERTY ACTION.status STRING
ALTER PROPERTY ACTION.status DEFAULT 'NEW'
CREATE INDEX ACTION.out_action_in ON ACTION (out, action, in) UNIQUE
CREATE CLASS LINK EXTENDS ACTION CLUSTERS 8
ALTER CLASS LINK CLUSTERSELECTION balanced
CREATE INDEX LINK.out_action_in ON LINK (out, action, in) UNIQUE
Dann tun wir Einsätze:
CREATE EDGE LINK FROM #12:0 TO #30:0 SET action = 'a';
können wählen wir und sehen, dass es richtig in die Datenbank eingefügt wurde:
orientdb {db=userdata}> SELECT FROM LINK WHERE action = 'a';
----+-----+------+------+-----+-----+------
# |@RID |@CLASS|action|out |in |status
----+-----+------+------+-----+-----+------
0 |#36:0|LINK |a |#12:0|#30:0|NEW
----+-----+------+------+-----+-----+------
Nun lasst uns create SB-Tree NOTUNIQUE Index (der Standardwert):
CREATE INDEX LINK.action_status ON LINK (action, status) NOTUNIQUE
Jetzt
Wir schaffen einen neuen Rekord:
CREATE EDGE LINK FROM #12:0 TO #30:0 SET action = 'b';
orientdb {db=userdata}> SELECT FROM LINK
----+-----+------+------+-----+-----+------
# |@RID |@CLASS|action|out |in |status
----+-----+------+------+-----+-----+------
0 |#36:0|LINK |a |#12:0|#30:0|NEW
1 |#37:8|LINK |b |#12:0|#30:0|NEW
----+-----+------+------+-----+-----+------
Jetzt versuchen wir, das 'a' und 'b' Werte zu wählen:
orientdb {db=userdata}> SELECT FROM LINK WHERE action = 'a';
----+-----+------+------+-----+-----+------
# |@RID |@CLASS|action|out |in |status
----+-----+------+------+-----+-----+------
0 |#36:0|LINK |a |#12:0|#30:0|NEW
----+-----+------+------+-----+-----+------
1 item(s) found. Query executed in 0.001 sec(s).
orientdb {db=userdata}> SELECT FROM LINK WHERE action = 'b';
0 item(s) found. Query executed in 0.001 sec(s).
ERKLÄREN:
Profiled command '{fullySortedByIndex:false,compositeIndexUsed:1,involvedIndexes:[1],limit:-1,fetchingFromTargetElapsed:0,indexIsUsedInOrderBy:false,user:#5:0,elapsed:1.116033,resultType:collection,resultSize:0}' in 0,002000 sec(s):
{"@type":"d","@version":0,"fullySortedByIndex":false,"compositeIndexUsed":1,"involvedIndexes":["LINK.action_status"],"limit":-1,"fetchingFromTargetElapsed":0,"indexIsUsedInOrderBy":false,"user":"#5:0","elapsed":1.116033,"resultType":"collection","resultSize":0,"@fieldTypes":"compositeIndexUsed=l,involvedIndexes=e,fetchingFromTargetElapsed=l,user=x,elapsed=f"}
Aber - wenn Sie es mit IN() auswählen - es ist da:
ERKLÄREN:
Profiled command '{documentReads:1,current:#36:1,documentAnalyzedCompatibleClass:1,recordReads:1,limit:-1,fetchingFromTargetElapsed:0,evaluated:1,user:#5:0,elapsed:0.666479,resultType:collection,resultSize:1}' in 0,002000 sec(s):
{"@type":"d","@version":0,"documentReads":1,"current":"#36:1","documentAnalyzedCompatibleClass":1,"recordReads":1,"limit":-1,"fetchingFromTargetElapsed":0,"evaluated":1,"user":"#5:0","elapsed":0.666479,"resultType":"collection","resultSize":1,"@fieldTypes":"documentReads=l,current=x,documentAnalyzedCompatibleClass=l,recordReads=l,fetchingFromTargetElapsed=l,evaluated=l,user=x,elapsed=f"}
Irgendwelche Vorschläge für dieses Problem?
Hallo, könnten Sie Problem auf GitHub hinzufügen und SQL-Team wird Ihre Abfrage analysieren? –