Re: The count query based on the vertex traversal edges is too slow!!!


wd w <wangwe...@...>
 


Hi,
Please help me look at the following question
https://groups.google.com/g/janusgraph-users/c/P-4hF5r9WuU/m/uPI0yRpJAwAJ
在2020年10月26日星期一 UTC+8 下午2:49:43<HadoopMarc> 写道:

Hi,

The first line in the code suggestion in my previous post should have been (added id() step):

targetIds = g.V().hasLabel('InstanceMetric').has('type', neq('network)).has('vlabel', 'InstanceMetric').id().toList()

Best wishes,    Marc

Op zondag 25 oktober 2020 om 16:57:58 UTC+1 schreef HadoopMarc:
Hi,

Apparently, the query planner is not able to use the index for the outV() step. Can you see what happens if we split the query like this (not tested):

targetIds = g.V().hasLabel('InstanceMetric').has('type', neq('network)).has('vlabel', 'InstanceMetric').toList()

g.V().hasLabel('InstanceMetric').has('type', neq('network)).has('vlabel', 'InstanceMetric')
    .inE('Cause').has('status', -1).has('isManual', false)
        .has('promote', within(-1,0,2,3)).has('vlabel', 'Cause')
        .where(outV().has(id, within(targetIds)))

Note that you can use the where() step instead of the as/select construct, just for readability.

HTH,   Marc

Op zaterdag 24 oktober 2020 om 15:19:12 UTC+2 schreef wan...@...:
The total number of sides is 15000

The edge data meets the query condition is only 10000 in total

在2020年10月24日星期六 UTC+8 下午9:18:48<wd w> 写道:
profile.png

在2020年10月20日星期二 UTC+8 下午10:38:46<HadoopMarc> 写道:
Can you show the profiling of the query using the profile() step?

Best wishes,    Marc

Op dinsdag 20 oktober 2020 om 14:22:59 UTC+2 schreef wan...@...:

g.V().hasLabel("Instance").has("instanceId", P.within("12", "34")).bothE('Cause').has('enabled', true).as('e').bothV().has('instanceId', P.within('64', '123')).select('e').count();

The above count query executes very slowly, what method can be used to speed up its query.

I have created compositeIndex and  mixedIndex for instanceId, enabled.

How should I convert this query to a direct index query!

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.