Index: /trunk/FACT++/src/fits2sql.cc
===================================================================
--- /trunk/FACT++/src/fits2sql.cc	(revision 19154)
+++ /trunk/FACT++/src/fits2sql.cc	(revision 19155)
@@ -68,4 +68,5 @@
         ("conditional",    po_switch(),               "Conditional insert. Only insert if no entry exists yet with the constants defined by --const")
         ("delete",         po_switch(),               "Delete all entries first which fit all constant columns defined by --const")
+        ("index",          po_switch(),               "If a table is created, all const columns are used as a single index")
         ;
 
@@ -197,4 +198,8 @@
         "If any row with the given constant values are found, the execution is stopped "
         "(note that this happend after the table drop/create but before the delete/insert.\n"
+        "\n"
+        "To ensure efficient access for a conditonal execution, it makes sense to have "
+        "an index created for those columns. This can be done during table creation "
+        "with the --index option.\n"
         "\n"
         "If a query failed, the query is printed to stderr together with the error message. "
@@ -324,4 +329,5 @@
     const bool conditional       = conf.Get<bool>("conditional");
     const bool run_delete        = conf.Get<bool>("delete");
+    const bool index             = conf.Get<bool>("index");
 
     const string engine          = conf.Get<string>("engine");
@@ -412,4 +418,5 @@
 
     string where;
+    vector<string> vindex;
     for (auto it=fixed.cbegin(); it!=fixed.cend(); it++)
     {
@@ -450,4 +457,5 @@
         vec.emplace_back(name, val);
         where += " AND `"+name+"`="+val;
+        vindex.emplace_back(name);
     }
 
@@ -581,4 +589,7 @@
         query += ",\n   PRIMARY KEY USING BTREE (`"+boost::algorithm::join(primary, "`, `")+"`)";
 
+    if (!vindex.empty() && index)
+        query += ",\n   INDEX USING BTREE (`"+boost::algorithm::join(vindex, "`, `")+"`)";
+
     query +=
         "\n)\n"
Index: /trunk/FACT++/src/root2sql.cc
===================================================================
--- /trunk/FACT++/src/root2sql.cc	(revision 19154)
+++ /trunk/FACT++/src/root2sql.cc	(revision 19155)
@@ -71,4 +71,5 @@
         ("conditional",    po_switch(),               "Conditional insert. Only insert if no entry exists yet with the constants defined by --const")
         ("delete",         po_switch(),               "Delete all entries first which fit all constant columns defined by --const")
+        ("index",          po_switch(),               "If a table is created, all const columns are used as a single index")
         ;
 
@@ -205,4 +206,8 @@
         "(note that this happend after the table drop/create but before the delete/insert.\n"
         "\n"
+        "To ensure efficient access for a conditonal execution, it makes sense to have "
+        "an index created for those columns. This can be done during table creation "
+        "with the --index option.\n"
+        "\n"
         "If a query failed, the query is printed to stderr together with the error message. "
         "For the main INSERT query, this is only true if the verbosity level is at least 2 "
@@ -319,4 +324,6 @@
     if (string(msg).substr(0,24)=="no dictionary for class ")
         return;
+    if (string(msg).substr(0, 5)=="unknown branch ")
+        return;
 
     DefaultErrorHandler(level, abort, location, msg);
@@ -353,4 +360,5 @@
     const bool conditional       = conf.Get<bool>("conditional");
     const bool run_delete        = conf.Get<bool>("delete");
+    const bool index             = conf.Get<bool>("index");
 
     const string engine          = conf.Get<string>("engine");
@@ -435,4 +443,5 @@
 
     string where;
+    vector<string> vindex;
     for (auto it=fixed.cbegin(); it!=fixed.cend(); it++)
     {
@@ -473,4 +482,5 @@
         vec.emplace_back(name, val);
         where += " AND `"+name+"`="+val;
+        vindex.emplace_back(name);
     }
 
@@ -615,4 +625,7 @@
     if (!primary.empty())
         query += ",\n   PRIMARY KEY USING BTREE (`"+boost::algorithm::join(primary, "`, `")+"`)";
+
+    if (!vindex.empty() && index)
+        query += ",\n   INDEX USING BTREE (`"+boost::algorithm::join(vindex, "`, `")+"`)";
 
     query +=
