Hi John, In MATCH statement (2.2) and more in general in 3.0 we are changing the optimization of queries based on indexes, but you will still need an index on the edge for such use case, so the big part of the work will be needed anyway.
Thanks Luigi 2017-03-16 12:43 GMT+01:00 John J. Szucs <[email protected]>: > Luigi, > > Yes, this helps. Your option #2 is more applicable to my project. > > Will OrientDB 3.0 significantly change/improve this use case? I don't want > to implement this manual edge index if it will become unnecessary in (a > few?) weeks. > > Thanks! > > -- John > > On Mar 16, 2017, at 07:24, Luigi Dell'Aquila <[email protected]> > wrote: > > Hi John, > > you have two alternatives: > > 1) use OrientVertex.countEdges() to check which of the two vertices has a > smaller number of edges. This approach is good if you know that at most one > is a supernode > > 2) if you know that both vertices can be supernodes, then the only > efficient way to find the edge is to define and index on edge(out, in) and > do the indexed query directly > > I hope it helps > > Thanks > > Luigi > > > 2017-03-16 11:18 GMT+01:00 John J. Szucs <[email protected]>: > >> I need to *very quickly* find the edges that directly connect two >> specified vertices, using either a SQL query, the Java API, or a >> combination of the two. If it helps, at this point in the program, I know >> for a fact that the two vertices are adjacent. What I'm trying to determine >> is *how* they are adjacent. >> >> The OrientVertex.getEdges(OrientVertex, Direction, String ...) extension >> to the Blueprints API does what I need to do functionally, but it can be >> quite slow if the first vertex has many edges. Looking into the source >> code, I found that this is because this method essentially gets *all* of >> the edges from the first vertex that match the direction and label criteria >> and then checks if they are adjacent (connect to) the second vertex. >> >> I have struggled with this for days. Does anyone have a better/faster >> approach? >> >> Thanks! >> >> -- 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 [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "OrientDB" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/orient-database/yyivlLcoS6A/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
