In Spring' 18 release, Salesforce has introduced critical update "Remove Instance Names From URLs for Visualforce, Community Builder, Site.com Studio, and Content Files". This update removes the instance name (ex. na15) from url.
We were getting instance name by parsing URL.getSalesforceBaseUrl().toExternalForm() in apex code of Visualforce Page. But, after activating critical update, my code breaks because I am no longer able to get instance name.
I googled this problem and found that we can query "Select InstanceName from Organization" to get instance name. But I am not sure which minimum permission or which other considerations are required to query Organization object. So, is there any other better approach to get instance name?