PLANNED MAINTENANCE

Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


question

baid_manish_187433 avatar image
baid_manish_187433 asked ·

How do we perform edge search in DSE 6.8 of properties stored from IN vertex to edge?

for quick traversal, we are planning to store (denormalized) some time-related properties from IN vertex into the edge.

Edge Search (new to 6.8) cannot be performed on such node as the partitioning keys (from OUT vertex) cannot be used through Tinkerpop interface, is only way to de-normalize ALL the primary from OUT vertex into edge?

UPDATE - A bit more detail:

Event <--- Account

schema.vertexLabel('Event').
    ifNotExists().
    partitionBy('tenantId', Ascii).
    clusterBy('eventCategory', Ascii, Asc).
    clusterBy('createTime', Timestamp, Desc).
    clusterBy('gid', Uuid, Asc)
schema.vertexLabel('Account').
    ifNotExists().
    partitionBy('tenantId', Ascii).
    clusterBy('entityGlobalId', Uuid, Asc)
schema.edgeLabel('WithEvent').
    ifNotExists().
    from('Account').to('Event')
    clusterBy('acknowledged', Boolean)

Question: Need to do edge search where following are provided:

edge.acknowledged + IN-Vertex with (tenantId, eventCategory, createTime>= Jan/2020)

Will DSE Graph optimize this query to just search in the Edge table? Given it contains all the fields (properties and primary key of the incident edges).

dsegraph
3 comments
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

To understand you better: Could you give an example of the edge search you want to perform, ideally with the desired graph schema after bringing the properties from the IN vertex into the edge?

Thanks!

0 Likes 0 · ·
baid_manish_187433 avatar image baid_manish_187433 bettina.swynnerton ♦♦ ·

[Updated original question with details]

0 Likes 0 · ·

thanks, I understand much better what you are trying to achieve. I will do some tests and research to see how this edge can be searched.

0 Likes 0 · ·

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered ·

Thanks for the detailed schema. I have populated with data and done tests.

Via Gremlin traversal API I have not been able to restrict the traversal queries to just hit the edge table. In addition, I had to create a materialized view in order to be able to search by the property acknowledged. The profile below shows you the traversal and which tables are being hit by the traversals. Both the MV on the edge and the Event vertex table are used to answer this query.

gremlin> g.E().hasLabel("WithEvent").has("acknowledged", true).and(__.inV().has("tenantId", "tenant2").has("eventCategory", "event1").has("createTime", gte('2009-10-23T10:15:30.00Z' as Instant))).profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
__.E().hasLabel("WithEvent").has("acknowledged"...                     1           1           1.707    45.90
  CQL statements ordered by overall duration                                                   0.458
    \_1=SELECT * FROM community_5076."Account__WithEvent__Event_by_acknowledged" WHERE acknowledged = ? / Dur
        ation: < 1 ms / Count: 1 / Index type: Materialized view
HasStep([~label.eq(WithEvent), acknowledged.eq(...                     1           1           0.077     2.08
AndStep([[__.inV().has("createTime",P.gte(java....                     1           1           1.549    41.67
  __.inV().has("createTime",P.gte(java.time.Ins...                     1           1           1.316
    CQL statements ordered by overall duration                                                 0.364
    \_1=SELECT * FROM community_5076."Event" WHERE "tenantId" = ? AND "createTime" = ? AND "eventCategory" =
          ? AND gid = ? / Duration: < 1 ms / Count: 1 / Index type: Table: Event
  HasStep([tenantId.eq(tenant2), eventCategory....                                             0.038
ReferenceElementStep                                                   1           1           0.384    10.35
                                            >TOTAL                     -           -           3.719        -
gremlin>

I now understand what you mean by not being able to use the partitioning keys (from OUT vertex) through Tinkerpop, as you cannot specify them in the has() filters on the edge. If you include them explicitly as edge properties, or more properties from the IN vertex, as in your example, you would likely need a search index to search the edge table for all these criteria to satisfy your query.

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks for the quick response.

So, an edge query cannot be performed unless MV or search-indexes are created - since there is no way to provide the partitioning key through gremlin.

Listing attribute-to-search-by as clustering key, like following would not help.

 schema.edgeLabel('WithEvent').
     ifNotExists().
     from('Account').to('Event')
     clusterBy('acknowledged', Boolean)

May be this can be improved in future.

0 Likes 0 · ·

Have you thought about querying the edge table directly through CQL? With the new edge table layout in Graph 6.8 this could perhaps be an alternative?

0 Likes 0 · ·