SQL case indexes

#3329
this is coming up in other PRs - how are you choosing the lengths of these? shouldn't ID's be much smaller than 255/512 generally?