Hi Riccardo,
Thank you for your response. I'm adding incides through Studio and I
believe I can see them there (screenshot below). A few more observations:
*1. Confusion about BOOLEAN WHERE clauses*
This query does *not* involve the index on the BOOLEAN field, contrary to
my expectation:
SELECT count(*) FROM TYPE_A WHERE active
These queries *do* involve that index, though.
SELECT count(*) FROM TYPE_A WHERE active = true
SELECT count(*) FROM TYPE_A WHERE active = 'true'
I had expected active to be equivalent to active = true.
*2. Confusion about data types*
While I've created my indices (by hand) to represent that actual data type (
BOOLEAN, LONG), all data has been imported as strings. I do notice that
there's some differences in query times, depending on how I "format" the
data type in my query, see my next point.
*3. I may have given inaccurate measurements*
This doesn't change my point (slowness), but here's an update:
- active // ~4,3s // index not involved, see point 4.
- active = true // ~3,0s // index involved
- active = 'true' // ~2,9s // index involved
- project_id = 14 // ~1,1s // index involved
- project_id = '14' // ~1,3s // index involved
*4. Are indices being hit?*
Well, yes, they are. I just accidentally gave you the EXPLAIN for WHERE
active, which just happened to be the only case of the above five queries
where the index wasn't involved.
Here's the EXPLAIN for active = 'true':
"limit": -1,
"compositeIndexUsed": 1,
"fullySortedByIndex": false,
"evaluated": 46325,
"documentAnalyzedCompatibleClass": 46325,
"projectionElapsed": 30,
"involvedIndexes": [
"TYPE_A.project_id"
],
"indexIsUsedInOrderBy": false,
"groupByElapsed": 0,
"current": "#18:122838",
"fetchingFromTargetElapsed": 861,
"documentReads": 46325,
"recordReads": 46325,
"elapsed": 869.006,
"resultType": "collection",
"resultSize": 1,
"@fieldTypes":
"compositeIndexUsed=l,evaluated=l,documentAnalyzedCompatibleClass=l,projectionElapsed=l,involvedIndexes=e,groupByElapsed=l,current=x,fetchingFromTargetElapsed=l,documentReads=l,recordReads=l,elapsed=f"
This looks to me like the expected index is involved. But from GitHub issue
#2706 <https://github.com/orientechnologies/orientdb/issues/2706> I take
away that it should not fetch "records it touches instead of just checking
for existence".
I'm sorry if I caused any confusion. It's my goal to make it as easy as
possible for you to help me! Your time is valuable and your help is greatly
appreciated!
I'm going by the assumption that I'm doing something wrong. I'm new to
OrientDB, and there's still a lot to learn!
Sander.
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.