diff --git a/jastadd-mquat-eris/src/main/java/de/tudresden/inf/st/mquat/eris/coupling/ERISConnector.java b/jastadd-mquat-eris/src/main/java/de/tudresden/inf/st/mquat/eris/coupling/ERISConnector.java index e695c8a5922f10b679e1932e0cca3e3ae613ec2c..06b53fd92c740b34fb112682c73a54ac17487617 100644 --- a/jastadd-mquat-eris/src/main/java/de/tudresden/inf/st/mquat/eris/coupling/ERISConnector.java +++ b/jastadd-mquat-eris/src/main/java/de/tudresden/inf/st/mquat/eris/coupling/ERISConnector.java @@ -273,14 +273,14 @@ public class ERISConnector { // get the new config ERISLPConfiguration newDOrOConfig = currentDOrIConfigs.get(attribute); - ERISAttributeStatistics as = livingPartition.getAttributeStatistics(attribute); + ERISAttributeStatistics attributeStatistics = livingPartition.getAttributeStatistics(attribute); logger.debug(" attribute {}:", attribute.getName()); logger.debug(" stats: lookups: {} inserts: {} scans: {} links: {} count: {}", - as.getLookups(), - as.getInserts(), - as.getScans(), - as.getLinks(), - as.getCount()); + attributeStatistics.getLookups(), + attributeStatistics.getInserts(), + attributeStatistics.getScans(), + attributeStatistics.getLinks(), + attributeStatistics.getCount()); // get the old config for the same attribute (if there is one) Optional<ERISLPConfiguration> oldConfig = livingPartition.getConfigForAttribute(attribute, false); @@ -342,6 +342,13 @@ public class ERISConnector { } else { logger.debug(" do NOT create an index {} to get an (index-) objective of {} (compared to {} without an index)", newIndexConfig, indexScore, lookupScoreWithoutIndex); } + } else { + // TODO this is our guess, but it seems reasonable to not get rid of an index if it causes no harm + // if there are no inserts, keep a potentially existing index + if (attributeStatistics.getInserts() == 0) { + // see if there is an index for the current attribute + livingPartition.getConfigForAttribute(attribute, true).ifPresent(configsToUse::add); + } } } }