Is there a more efficient way to return all records in a "traversed" link'ed list?

Skip to first unread message


Jan 22, 2018, 9:07:02 PM1/22/18
to OrientDB
I have a generic (non-V) class with a LINKMAP field that links a chain of time-series data. Each record links to the next record based on a key of the next month/day/hour/etc. and a value of the @rid of the next record. I could use edges (non-lightweight, with a single property the same as the LINKMAP key), but I don't want to because I only need a one-direction link and want to use the least amount of storage space (plus my assumption is that while using edges might offer slightly easier querying, it wouldn't offer any benefit in terms of performance or storage space).

I currently have the following batch query:

let r
= select from data where key='AAA';
let y
= select expand(links['2017']) from $r;
let m
= select expand(links['07']) from $y;
let d
= select expand(links['15']) from $m;
let h
= select expand(links['10']) from $d;
return (select $r[0], $y[0], $m[0], $d[0], $h[0])

This works, in the sense that I get a result set with the @rids of each record in the link'ed list.

I have two questions:
  1. Is there a more efficient way to do this query? I've tried various TRAVERSE options with $path and such, but nothing else I attempted worked at all. I did not try MATCH because I'm not using edges.
  2. The current result set is flat, with each value prop ($r, $y, etc.) containing the corresponding @rid. That's OK for my purposes, but I'd like to know if there's a way to return the actual records instead of just the @rids. Nothing I've tried works.
PS - I'm using orientjs, but the batch runs identically from the console as well.

Reply all
Reply to author
0 new messages