I am building a data model in greenDAO. It is a port of an iOS app that uses Core Data. In iOS we use indexes (indices?) to increase lookup performance in a table of 20 columns (properties) where 5 columns are frequently queried. I know this results in extra storage and provides slower writes into the table.
Digging in the documentation, I came across the addIndex(Index index) method in Entity and the index() method in Property.PropertyBuilder. Which is the correct way to add an index to an Entity?
Entity entity = schema.addEntity("entity");
entity.setSuperclass("SuperClass");
entity.addIdProperty();
entity.addIntProperty("property").index();
or
Entity entity = schema.addEntity("entity");
entity.setSuperclass("SuperClass");
entity.addIdProperty();
Property property = entity.addIntProperty("property").getProperty();
entity.setIndex(property);
Or do they both do the same thing?