Query Collection (LINKSET, LINKLIST, RIDBAG) Elements from Parent RID

131 views
Skip to first unread message

Bryan

unread,
Sep 16, 2015, 6:34:40 PM9/16/15
to orient-...@googlegroups.com
OrientDB 2.1.2
plocal connection
ODocument API

Hi all,

Evaluating OrientDB, I'm trying to optimize a query that is running out of memory and pretty slow. I'm sure I must be doing something wrong.
Say I have a simple schema like the following:

log 
  + name (String)
  + events (RIDBAG of log_event)

log_event
  + message (String)
  + level (int)
  + timestamp (Date)

and say I want to find all of the log events from a list of logs that have a specified level and order by timestamp...
I.e. "select from (select expand(log_events) from [#10:0, #10:1, #10:4]) where log_level = 1 ORDER BY timestamp ASC LIMIT 1000"

This works fine but when I start to get 100k+ records, things slow down and explode and such. I'm sure my query must be the problem.

So the question is, how can I "efficiently" query collections and get the OIdentifiable or ODocument that satisfy a given condition?
Also, I'm open to using the Java API if that is better...



Luigi Dell'Aquila

unread,
Sep 17, 2015, 3:05:06 AM9/17/15
to orient-...@googlegroups.com
Hi Bryan,

probably the problems arises because the system has to expand all these big collections in memory.
I'd suggest you to change your model a bit, adding a reverse link from log_event to log (or even better, an edge), so that you can refactor your query like following:

select from log_event where log in [#10:0, #10:1, #10:4] and log.log_level = 1 ORDER BY timestamp ASC LIMIT 1000

this way you will have much more flexibility in adding indexes on log and timestamp properties, it will optimize a lot filtering and sorting and it will also save a lot of memory (sorting is a memory intensive operation)

Luigi


2015-09-17 0:34 GMT+02:00 Bryan <bryan_...@selinc.com>:
OrientDB 2.1.2
plocal connection
ODocument API

Hi all,

Evaluating OrientDB, I'm trying to optimize a query that is running out of memory and pretty slow. I'm sure I must be doing something wrong.
Say I have a simple schema like the following:

log 
  + name (String)
  + events (RIDBAG of log_event)

log_event
  + message (String)
  + level (int)
  + timestamp (Date)

and say I want to find all of the log events from a list of logs that have a specified level and order by timestamp...
I.e. "select from (select expand(log_events) from [#10:0, #10:1, #10:4]) where log_level = 1 ORDER BY timestamp ASC LIMIT 1000"

This works fine but when I start to get 100k+ records, things slow down and explode and such. I'm sure my query must be the problem.

So the question is, how can I query collections and get the OIdentifiable or ODocument that satisfy a given condition?



--

---
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 orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages