Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexes not working when querying inside the cluster #4606

Closed
lasitha1991 opened this issue Jul 20, 2015 · 11 comments
Closed

Indexes not working when querying inside the cluster #4606

lasitha1991 opened this issue Jul 20, 2015 · 11 comments
Assignees

Comments

@lasitha1991
Copy link

I'm using document type database in Orientdb 2.0.3.

I have a class A which has an field attr1 and I have created NOTUNIQUE_HASH_INDEX index on that attr1.

Recently I have clustered class A into few clusters named A_1, A_2, A_3 ...

After that when I'm querying for a record in Class A I have noticed the following:

if I execute a query like this,
select from A where attr1 = #10:111 AND ...
it uses the index on attr1 and do document reads around 1500 (which gives results pretty fast)

But if I execute a query like this,
select from cluster:A_1 where attr1 = #10:111 AND ...
it does not use the index on attr1 and do document reads around 14000 (which is the number of records in that cluster)

Note: I have rebuild the index also and still the result is same.

Is this a bug or a feature??

@smolinari
Copy link
Contributor

@lvca lvca closed this as completed Jul 20, 2015
@lvca
Copy link
Member

lvca commented Jul 20, 2015

Indexes works at class level, not index level. We're working to a new spec to allow this, but right now this isn't supported, sorry. You could rather create multiple classes by using inheritance and in this case each class would have own index.

@smolinari
Copy link
Contributor

You mean indexes work at class level and not at cluster level, correct?

Scott

@lasitha1991
Copy link
Author

Thank you vary much for the Reply Lvca,

People would love to have that as an feature. So please try to implement that in the future.

Lasitha Weerasinghe

@smolinari
Copy link
Contributor

@lvca - mentioning you to (politely) get your attention to the question I asked above. I'm sorry, but I didn't understand your answer completely.

Scott

@lvca
Copy link
Member

lvca commented Jul 21, 2015

@smolinari which part of the answer? How to use inheritance?

@Eric24
Copy link

Eric24 commented Jul 21, 2015

@lvca: If I understand this right, are you saying that ODB won't/can't use an index on a clustered class (without the inheritance approach)? If so, I'd love to see an example of how inheritance would make this work.

@lasitha1991
Copy link
Author

According to my understanding he is referring to something like this.

In my above mentioned scenario, instead of creating a cluster named as A_1, I have to create a new class A_1, inherited from class A.

Then the indexes I have created for Class A will be inherited to class A_1 also. (And even I can create specific indexes for the A_1 class also.)

So when I'm retrieving data I can query like "select from A_1 where ..." and this query will use the indexes created for class A and also for the Class A_1.

@smolinari
Copy link
Contributor

@lvca - you said this.

Indexes works at class level, not index level.

and I asked this

You mean indexes work at class level and not at cluster level, correct?

I am not sure what you meant with "index level", if that is what you meant to say.

Scott

@luigidellaquila
Copy link
Member

Hi Scott,

yes, I guess it was just a typo ;-)
Indexes in OrientDB can be defined on classes, not on single clusters.
Eg. if you have a class called Person, with two clusters called "person_1"
and "person_2", you can define an index Person.name and all the records
contained in "person_1" and "person_2" will be indexed into that.
On the other side, there is no way to define an index directly on a
cluster, eg. on "person_1" only

Luigi

2015-07-22 6:43 GMT+02:00 Scott notifications@github.com:

@lvca https://github.com/lvca - you said this.

Indexes works at class level, not index level.

and I asked this

You mean indexes work at class level and not at cluster level, correct?

I am not sure what you meant with "index level", if that is what you meant
to say.

Scott


Reply to this email directly or view it on GitHub
#4606 (comment)
.

@smolinari
Copy link
Contributor

Thanks Luigi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants