Would that be equivalent to:
graph.query().has("@class", "User").has("id", id).limit(1).vertices()
On Thursday, July 24, 2014 8:47:25 AM UTC-4, Lvc@ wrote:
>
> Hi Seamus,
> seems the index is not used on that query. By looking at the code the
> reason is simple: you used custom types, so you should use User.id and not
> only id:
>
> for (Vertex v : graph.query().has("User.id", dbuser.id).limit(1).vertices
> ()){}
>
> For more information look the documentation:
> https://github.com/orientechnologies/orientdb/wiki/Graph-Database-Tinkerpop#use-indices
>
> Lvc@
>
>
>
> On 24 July 2014 14:15, Seamus Minogue <[email protected] <javascript:>>
> wrote:
>
>> Still dealing with this problem as I mentioned earlier the slowdown just
>> gets longer and longer the more records I stuff in. But after the
>> application runs and exists I then open the DB and queries are very fast. I
>> also notice that while I am stuffing in records the size of the DB grows
>> pretty dramatically (4gb) but then once import is complete this size
>> shrinks down to around 200mb.
>>
>> I am wondering if there is something I need to periodically do like tell
>> the DB to compact itself and update indexes or something? Its either that
>> or I guess I close the DB then re-open it to start adding more for every X
>> thousand vertices I insert. This seems like something I shouldnt have to
>> do...
>>
>>
>>
>> On Tuesday, July 22, 2014 10:10:15 PM UTC-4, Seamus Minogue wrote:
>>>
>>> Yes that seems to be it. The time seems to increase as more records are
>>> inserted. When its <500 records I'm seeing like 10 per second. But when
>>> There are like 3500 records having been inserted I'm seeing as much as 3
>>> seconds per query.
>>>
>>> Do I need to do something to force the index to "re-index" the records
>>> being added?
>>>
>>> -Seamus
>>>
>>>
>>> On Tuesday, July 22, 2014 6:19:47 PM UTC-4, Lvc@ wrote:
>>>>
>>>> Hi Seamus,
>>>> So where most the time is spent? In the following line of code?
>>>>
>>>> for (Vertex v : graph.query().has("id", dbuser.id).limit(1).vertices())
>>>>
>>>> Lvc@
>>>>
>>>>
>>>>
>>>> On 22 July 2014 22:10, Seamus Minogue <[email protected]> wrote:
>>>>
>>>>> The scenario is that I am trying to pull a bunch of data out of an
>>>>> existing database and storing it in an orientDb which is running embedded
>>>>> in my application. I am running into some performance problems,
>>>>> specifically when I add queries to verify that the data I am about to
>>>>> insert into orient is unique the performance is killing me.
>>>>>
>>>>> I am only dealing with 7000 rows of data in my database as a test
>>>>> case, The below snippet of code is showing what I am doing. Assume that
>>>>> of
>>>>> the 7000 rows there are 1500 unique user ID's. When I just do inserts and
>>>>> dont worry about duplicates This runs in 7 seconds. When I add the query
>>>>> its taking ~20mins.
>>>>>
>>>>> I was going through the performance tuning suggestions trying to find
>>>>> an answer... I figure I must be doing something wrong.
>>>>>
>>>>>
>>>>> OServer server = OServerMain.create();
>>>>>
>>>>> server.startup(...);
>>>>>
>>>>> server.activate();
>>>>> graph = new OrientGraphNoTx("plocal:/tmp/test", "admin", "admin");
>>>>>
>>>>> graph.getRawGraph().declareIntent(new OIntentMassiveInsert());
>>>>> graph.getRawGraph().setValidationEnabled(false);
>>>>>
>>>>> graph.getRawGraph().setRetainRecords(false);
>>>>>
>>>>> graph.createKeyIndex("id", Vertex.class, new Parameter<String, String
>>>>> >("type", "UNIQUE"), new Parameter<String, String>("class", "User"));
>>>>>
>>>>> //Read user from existing store and create object (mundane details)
>>>>> User dbuser = fetchUserFromOutside();
>>>>>
>>>>> Vertex user = null;
>>>>>
>>>>> for (Vertex v : graph.query().has("id", dbuser.id).limit(1).vertices()
>>>>> )
>>>>>
>>>>> {
>>>>> user = v;
>>>>> }
>>>>>
>>>>> if(user == null){
>>>>>
>>>>> user =graph.addVertex("class:User","id", dbuser.id);
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> ---
>>>>> 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] <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 [email protected].
For more options, visit https://groups.google.com/d/optout.