Using Orient v 2.1.0
How to reproduce:
1) create class MObject extends V abstract
2) create property MObject._oid string
3) create property MObject._ns string
Then create indexes
create index MObject._oid unique_hash_index
create index MObject._ns notunique_hash_index
Now start creating classes that inherit from MObject.
create class M1 extends MObject
create class M2 extends MObject
create class M3 extends MObject
create class M4 extends MObject
create class M5 extends MObject
...and so on all the way to M30 extends MObject
This gets slower and slower as more and more classes that extend MObject are created. As far as I can tell, this is because of the following code in OSchemaShared.java
for (OIndex<?> index : superClass.getIndexes())
for (String clusterName : clusterNames)
if (clusterName != null)
database.getMetadata().getIndexManager().addClusterToIndex(clusterName, index.getName());
As the number of classes that inherit from MObject gets higher, the time taken to create a new class is as high as 16 seconds, and possibly more.
If I remove the indexes (or create them later), create class returns almost immediately; so it certainly appears that every create class extends statement is updating the index in some fashion as seen in the code above and adds significant overhead.
Interestingly, if I do this
create class M30
alter class M30 superclass MObject
then the create class completes pretty quickly, although the two ways of creating the class should be equivalent. Ideally, "create class M30 extends MObject" should have the same performance as when the statements are split.
Thanks,
--Harish.