Managing collections

EyeDB collection implementations

EyeDB supports several types of collections:

  • set: unordered collection without element duplication

  • bag: unordered collection with element duplication

  • array: ordered collection

Independentely from its type, a collection has an implementation, i.e. the data structure that supports the collection. EyeDB supports several types of implementation, either indexed or non-indexed:

  • hash index

  • btree index

The choice of the collection implementation will have of course an impact on the collection performance for inserting, deleting retrieving objects. For example, having a bag collection containing a large number of elements and not using an indexed implementation will have poor performance for element insertion: when inserting an element in a bag collection, EyeDB must lookup the element in the collection to check for duplication and this will have poor performance if the lookup is not accelerated using an index.

Example 6.10. The ODL database schema for collections

class Person {
  attribute string firstName;
  attribute string lastName;
};

class Diary {
  attribute string name;
  attribute set<Person *> persons;
};

Example 6.11. Collections: updating the schema

## create database
eyedbadmin database create test_collection
eyedbodl -u -d test_collection test_collection.odl
Updating 'test_collection' schema in database test_collection...
Adding class Person
Adding class Diary

Done
	  

Getting and setting collection default implementation

Example 6.12. eyedbadmin

## getting and setting default implementation
eyedbadmin collection getdefimpl test_collection Diary.persons
Default implementation on Diary.persons:
  System default
eyedbadmin collection setdefimpl --type=hashindex test_collection Diary.persons
eyedbadmin collection getdefimpl test_collection Diary.persons
Default implementation on Diary.persons:
  Type: Hash
	  

Getting and updating a particular collection implementation

Getting statistics on a collection implementation

Getting and setting collection default dataspace