Database: when memory allocation fails during sorting, perform a GC cycle and retry
Database: allow duplicate entries in projection indices
Performance improvements: use Sorting.permute and projections when possible