Luigi, This reduced the overall run-time for the method that uses this query by about 75%!
As an FYI for future readers, I believe the second "WHERE" in suggested SQL statement should be an AND. Thank you very much for the quick and helpful response! -- John On Friday, December 23, 2016 at 2:33:49 AM UTC-5, Luigi Dell'Aquila wrote: > > Hi John, > > You can try with the following: > > SELECT FROM YourClass where key = :k where in('Child') contains :p > > in a situation where you have supernodes it will be faster, but of course > it will be a bit slower when you have small fan out > > Thanks > > Luigi > > > 2016-12-22 20:57 GMT+01:00 John J. Szucs <john.j...@gmail.com > <javascript:>>: > >> In my project, I have a fairly large prefix tree, potentially containing >> millions of nodes (about 250K nodes in my development instance), managed in >> OrientDB (pointing to other vertices in my graph). >> >> The nodes of the prefix tree are represented by a Token vertex type. Each >> Token has a 'key' property and is connected to its child vertices by a >> 'child' edge type. So, a sequence like "hello world" would be represented >> as: >> >> root -child-> "hello" -child-> "world" >> >> >> Currently, I have a NOTUNIQUE_HASH_INDEX on Token.key and I am querying >> the data structure like this: >> >> SELECT EXPAND(OUT('child')[key=:k]) FROM :p >> >> >> where *k* is the child key I am looking for and *p* is the RID of the >> parent node. >> >> Generally, performance is pretty good, but I am looking for ideas on >> improving the query, the indexing, or both for this use case. In >> particular, queries starting at the root node, which has many children, >> take noticeably longer than the other, less-connected nodes. >> >> Any suggestions? Thanks in advance! >> >> -- John >> >> -- >> >> --- >> 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 <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- 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-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.