Hi Fabrizio,
In my experience, there numbers seem a bit too high...
Just a couple of questions (sorry, I don't know if you already answered
before, maybe I missed it...)
- how big is your DB?
- what is your configuration? (RAM, heap, off-heap and so on)
- I see you are using out() without any edge class names, do you have a
schema defined? Can you try to use edge class names, eg out("TheEdgeClass")?
Could you also please try to rewrite the queries this way and let me know
if they are better?
select
out()[drugname = 'TRIZIVIR'].out()[age > 29 and age < 46].size()
from indi
where
indi_pt = 'HIV infection'
or even better
select
out("TheEdgeClassName")[drugname = 'TRIZIVIR'].out("TheEdgeClassName")[age
> 29 and age < 46].size()
from indi
where
indi_pt = 'HIV infection'
```````Thanks
Luigi
2016-07-08 12:25 GMT+02:00 Fabio Rinnone <[email protected]>:
> Il 02/07/2016 05:44, Luca Garulli ha scritto:
> > Did you create an INDEX (non hash) against demo.age and an HASH_INDEX
> > against drugname?
>
> I have tried to use out() instead of in() in OrientDB query and time
> execution are better, but if I add indexes yet in MySQL schema execution
> times in MySQL remains better than OrientDB.
>
> First example (2 tables join):
>
> select count(*) as total from ( select expand(out()) from drug where
> drugname = 'TRIZIVIR' ) where age > 29 and age < 46
>
> requires 1.698 sec in OrientDB.
>
> Equivalent query in MySQL:
>
> select count(*) as total from drug, demo where drug.primaryid =
> demo.primaryid and demo.age > 29 and demo.age < 46 and drug.drugname =
> 'TRIZIVIR'
>
> requires less than 0.01 sec.
>
> Second example (3 tables join):
>
> select count(*) as total from ( select expand(out()) from ( select
> expand(out()) from indi where indi_pt = 'HIV infection' ) where drugname
> = 'TRIZIVIR' ) where age > 29 and age < 46
>
> requires 80.66 sec in OrientDB.
>
> Equivalent query in MySQL:
>
> select count(*) as total from indi, drug, demo where indi.primaryid =
> drug.primaryid and indi.indi_drug_seq = drug.drug_seq and drug.primaryid
> = demo.primaryid and indi.indi_pt = 'HIV infection' and drug.drugname =
> 'TRIZIVIR' and demo.age > 29 and demo.age < 46;
>
> require also less than 0.01 sec.
>
> --
> Fabio Rinnone
> Skype: fabiorinnone
> Web: http://www.fabiorinnone.eu
>
> --
>
> ---
> 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.