[INTERNAL] sql refactoring started