Outline of adding indexes for direct queries.
Use the key by default since custom vars are grouped by this first.
Make custom variables appear in web GUI by object id (scode).