Skip to content

What performance gain should I be expecting with indexes on graph databases? #1417

@shasaur

Description

@shasaur

I'm trying to incorporate indexes into my ArcadeDB set-up. I want to know if the indexes I set-up are correctly configured and being utilised. I've set them up with:

create property Action.personId if not exists integer;
create property EntityAction.personId if not exists integer;
create index if not exists on Action (personId) notunique;
create index if not exists on EntityAction (personId) notunique;

Given a query which takes about ~5.5ms (range 5.0-6.5ms)

MATCH (act:Action {personId: 1})<-[:OF_ACTION]-(entityAct:EntityAction {personId: 1})
RETURN id(entityAct) AS id, act.name AS actionName

With node numbers:

  • Action nodes: 1,474
  • EntityAction nodes: 23,695

What new performance should I expect? There's about 70 personId values (categories you could say) for which the data is split evenly between. I'm seeing a new performance of ~4.5ms (range 3.6-5.2ms), is that to be expected? I think I would have expected faster for this use case of indexes.

Further information

Explain query without indexes:

Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
ArcadeFilterByTypeStep(vertex,Action)                               1474        1474           0.526    10.26
HasStep([personId.eq(1)])@[act]                                       22          22           0.718    14.01
VertexStep(IN,[OF_ACTION],vertex)                                    356         356           0.277     5.41
HasStep([~label.eq(EntityAction), personId.eq(1...                   356         356           0.366     7.15
SelectStep(last,[entityAct, act])                                    356         356           0.251     4.89
NoOpBarrierStep(2500)                                                356         356           0.335     6.54
ProjectStep([id, actionName],[[SelectOneStep(la...                   356         356           2.655    51.74
  SelectOneStep(last,entityAct,null)                                 356         356           0.109
  IdStep                                                             356         356           0.093
  SelectOneStep(last,act,null)                                       356         356           0.117
  ChooseStep([PropertiesStep([name],value), Has...                   356         356           0.990
    PropertiesStep([name],value)                                     356         356           0.137
    HasNextStep                                                      356         356           0.068
    PropertiesStep([name],value)                                     356         356           0.104
    EndStep                                                          356         356           0.077
    ConstantStep(null)                                                                         0.000
    EndStep                                                                                    0.000
                                            >TOTAL                     -           -           5.131        -

Explain query with indexes:

Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
ArcadeFilterByIndexStep(vertex,[com.arcadedb.da...                    22          22           0.041     0.95
HasStep([personId.eq(1)])@[act]                                       22          22           0.027     0.63
VertexStep(IN,[OF_ACTION],vertex)                                    356         356           0.274     6.29
HasStep([~label.eq(EntityAction), personId.eq(1...                   356         356           0.328     7.52
SelectStep(last,[entityAct, act])                                    356         356           0.231     5.31
NoOpBarrierStep(2500)                                                356         356           0.330     7.58
ProjectStep([id, actionName],[[SelectOneStep(la...                   356         356           3.129    71.72
  SelectOneStep(last,entityAct,null)                                 356         356           0.133
  IdStep                                                             356         356           0.105
  SelectOneStep(last,act,null)                                       356         356           0.130
  ChooseStep([PropertiesStep([name],value), Has...                   356         356           1.147
    PropertiesStep([name],value)                                     356         356           0.149
    HasNextStep                                                      356         356           0.080
    PropertiesStep([name],value)                                     356         356           0.124
    EndStep                                                          356         356           0.090
    ConstantStep(null)                                                                         0.000
    EndStep                                                                                    0.000
                                            >TOTAL                     -           -           4.362        -

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions