Fix tabs/line endings
Do cheap (non DB) call first
Merge pull request #3794 from guruz/sharing_db_call_reorder

Sharing db call reorder