SQL lock fixes, SQL parallelism, misc config

More work on exploiting SQL parallelism.

Also, centralize configuration parameters.