some years ago there was a chat around query hints
http://www.objectdb.com/issue/2417
we are currently trying that with the latest version but we do not see that our hint is used
this is the query:
SELECT DISTINCT o from ObjectNode o join o.properties p1 join o.properties p2 join o.properties p3 join o.properties p4 where o.classIdentifier = '(OP)' and o.linkedObjects.classIdentifier = '(TC)' and o.linkedObjects.objectNameUpper = '3D-PRINT' and o.linkedObjects.state = 0 and o.linkedObjects.type = 1 and o.properties.name = 'roughPlanning' and o.properties.doubleValue = 1 and p1.name = 'globalFeedback' and p1.doubleValue = 0 and ((p2.name = 'scheduledSlot' and p2.doubleValue < 2795) and (p3.name = 'scheduledEndSlot' and p3.doubleValue >= 2795) and (p4.name = 'slots' and p4.doubleValue > 0))
[[objectdb.query-plan-text=index(ctso['(TC)'->'(TC)']]
but the index that is in the hint is not used
the MultiVarPlan that is listed shows our index in a filterPlan:
<filterPlan 2.0848 0,56/0,00 (v$1.classIdentifier='(TC)')>
<filterPlan 2.0636 0,54/0,00 (v$1.objectNameUpper='3D-PRINT')>
<filterPlan 2.0424 0,52/0,00 (v$1.state=0)>
<filterPlan 2.0212 0,50/0,00 (v$1.type=1)>
This is the complete explorer output:
Query plan 1/128 description
============================
Step 1: Process ObjectNode (o) instances
----------------------------------------
[Step 1a]
Scan index com.agile.hummingbird.ObjectNode[classIdentifier]
locating ObjectNode (o) instances that satisfy:
(o.classIdentifier='(OP)').
[Step 1b]
Retrieve fields in ObjectNode (o) instances.
Step 2: Process ObjectProperty (v$2) instances
(for every result of step 1)
----------------------------------------------
[Step 2a]
Iterate over all the instances (v$2) in o.properties.
[Step 2b]
Retrieve fields in ObjectProperty (v$2) instances.
[Step 2c]
Filter the results of step 2b
retaining only results that satisfy:
(v$2.doubleValue=1).
[Step 2d]
Filter the results of step 2c
retaining only results that satisfy:
(v$2.name='roughPlanning').
Step 3: Process ObjectNode (v$1) instances
(for every result tuple of the steps above)
------------------------------------------
[Step 3a]
Iterate over all the instances (v$1) in o.linkedObjects.
[Step 3b]
Retrieve fields in ObjectNode (v$1) instances.
[Step 3c]
Filter the results of step 3b
retaining only results that satisfy:
(v$1.type=1).
[Step 3d]
Filter the results of step 3c
retaining only results that satisfy:
(v$1.state=0).
[Step 3e]
Filter the results of step 3d
retaining only results that satisfy:
(v$1.objectNameUpper='3D-PRINT').
[Step 3f]
Filter the results of step 3e
retaining only results that satisfy:
(v$1.classIdentifier='(TC)').
Step 4: Process ObjectProperty (p2) instances
(for every result tuple of the steps above)
---------------------------------------------
[Step 4a]
Iterate over all the instances (p2) in o.properties.
[Step 4b]
Retrieve fields in ObjectProperty (p2) instances.
[Step 4c]
Filter the results of step 4b
retaining only results that satisfy:
(p2.doubleValue<2795).
[Step 4d]
Filter the results of step 4c
retaining only results that satisfy:
(p2.name='scheduledSlot').
Step 5: Process ObjectProperty (p1) instances
(for every result tuple of the steps above)
---------------------------------------------
[Step 5a]
Iterate over all the instances (p1) in o.properties.
[Step 5b]
Retrieve fields in ObjectProperty (p1) instances.
[Step 5c]
Filter the results of step 5b
retaining only results that satisfy:
(p1.doubleValue=0).
[Step 5d]
Filter the results of step 5c
retaining only results that satisfy:
(p1.name='globalFeedback').
Step 6: Process ObjectProperty (p3) instances
(for every result tuple of the steps above)
---------------------------------------------
[Step 6a]
Iterate over all the instances (p3) in o.properties.
[Step 6b]
Retrieve fields in ObjectProperty (p3) instances.
[Step 6c]
Filter the results of step 6b
retaining only results that satisfy:
(p3.doubleValue>=2795).
[Step 6d]
Filter the results of step 6c
retaining only results that satisfy:
(p3.name='scheduledEndSlot').
Step 7: Process ObjectProperty (p4) instances
(for every result tuple of the steps above)
---------------------------------------------
[Step 7a]
Iterate over all the instances (p4) in o.properties.
[Step 7b]
Retrieve fields in ObjectProperty (p4) instances.
[Step 7c]
Filter the results of step 7b
retaining only results that satisfy:
(p4.doubleValue>0).
[Step 7d]
Filter the results of step 7c
retaining only results that satisfy:
(p4.name='slots').
Step 8: Apply selection
-----------------------
Apply selection and prepare final results.
<multiVarPlan 27.6031 4,00/2,65 o,p1,p2,p3,p4,v$1,v$2>
<multiVarPlan 23.5183 3,93/2,65 o,p1,p2,p3,v$1,v$2>
<multiVarPlan 19.4335 3,84/2,65 o,p1,p2,v$1,v$2>
<multiVarPlan 15.3488 3,74/2,65 o,p2,v$1,v$2>
<multiVarPlan 11.264 3,60/2,65 o,v$1,v$2>
<multiVarPlan 7.0945 3,38/2,65 o,v$2>
<extractPlan 3.0098 2,96/2,65 o(ObjectNode)>
<btreePlan 1.0098 1,12/2,65 o(ObjectNode) index(-103['(OP)'->'(OP)':notNull]) />
</extractPlan>
<filterPlan 2.0424 0,52/0,00 (v$2.name='roughPlanning')>
<filterPlan 2.0212 0,50/0,00 (v$2.doubleValue=1)>
<extractPlan 2.0 0,48/0,00 v$2(ObjectProperty)>
<boundPlan 0.0 0,00/0,00 v$2(ObjectProperty) bound(o.properties) />
</extractPlan>
</filterPlan>
</filterPlan>
</multiVarPlan>
<filterPlan 2.0848 0,56/0,00 (v$1.classIdentifier='(TC)')>
<filterPlan 2.0636 0,54/0,00 (v$1.objectNameUpper='3D-PRINT')>
<filterPlan 2.0424 0,52/0,00 (v$1.state=0)>
<filterPlan 2.0212 0,50/0,00 (v$1.type=1)>
<extractPlan 2.0 0,48/0,00 v$1(ObjectNode)>
<boundPlan 0.0 0,00/0,00 v$1(ObjectNode) bound(o.linkedObjects) />
</extractPlan>
</filterPlan>
</filterPlan>
</filterPlan>
</filterPlan>
</multiVarPlan>
<filterPlan 2.0424 0,52/0,00 (p2.name='scheduledSlot')>
<filterPlan 2.0212 0,50/0,00 (p2.doubleValue<2795)>
<extractPlan 2.0 0,48/0,00 p2(ObjectProperty)>
<boundPlan 0.0 0,00/0,00 p2(ObjectProperty) bound(o.properties) />
</extractPlan>
</filterPlan>
</filterPlan>
</multiVarPlan>
<filterPlan 2.0424 0,52/0,00 (p1.name='globalFeedback')>
<filterPlan 2.0212 0,50/0,00 (p1.doubleValue=0)>
<extractPlan 2.0 0,48/0,00 p1(ObjectProperty)>
<boundPlan 0.0 0,00/0,00 p1(ObjectProperty) bound(o.properties) />
</extractPlan>
</filterPlan>
</filterPlan>
</multiVarPlan>
<filterPlan 2.0424 0,52/0,00 (p3.name='scheduledEndSlot')>
<filterPlan 2.0212 0,50/0,00 (p3.doubleValue>=2795)>
<extractPlan 2.0 0,48/0,00 p3(ObjectProperty)>
<boundPlan 0.0 0,00/0,00 p3(ObjectProperty) bound(o.properties) />
</extractPlan>
</filterPlan>
</filterPlan>
</multiVarPlan>
<filterPlan 2.0424 0,52/0,00 (p4.name='slots')>
<filterPlan 2.0212 0,50/0,00 (p4.doubleValue>0)>
<extractPlan 2.0 0,48/0,00 p4(ObjectProperty)>
<boundPlan 0.0 0,00/0,00 p4(ObjectProperty) bound(o.properties) />
</extractPlan>
</filterPlan>
</filterPlan>
</multiVarPlan>