refs #683, a hack to not allocate cursor ids in queryWithQueryOptimizer unless
the cursor is being saved. For small queries, reduces contention on
ccmutex.

This checkin is for experimentation purposes only.

Memory leak also fixed.