Insert into optimizer_cost_factors table
Fix the map usage

Accessing a map element via `[]` creates a new object, if the
key is not present. Now we first do a find and then insert, if key
is not present.