Sql optimise nested set merged all

Sql optimise nested set merged all the nestedset related branches