Database: sort is quicker than array_diff
Database\Selection: use cache caching root
Database: fixed Selection::ref() data invalidation. Thanks @JanTvrdik & @Eda
Database: removed useless condition
Database: load previousAccessedColumns just one time if it's null
Merge pull request #995 from hrach/database-optimalization

Database optimalization