Sql optimise nested set merge

### THIS IS JUST TO SEE DIFFERENCE, MIGHT NOT HELPFUL