closes #785, don't allocate cursor ids in queryWithQueryOptimizer unless
the cursor is being saved. For small queries, reduces contention on
ccmutex.