Name resolution in Azure SQL Database

John Couch 181 Reputation points
2021-06-11T19:15:02.317+00:00

We all know you are not supposed to name your object sp_ in SQL Server as it is typically reserved for system objects and will normally result in a master database search first, HOWEVER, seeing how Azure SQL Database is not a typical SQL server installation, is that still the case?

Not looking for lectures on why does it matter just don't do it, I am curious if it still works the same or not. I realize its technically still a SQL Server with restrictions to limit you to a scoped database and using resource governor, but...

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Alberto Morillo 33,536 Reputation points MVP
    2021-06-11T22:49:03.397+00:00

    I tested with a stored procedure. I copy the stored procedure with the same name but I added the "sp_" prefix, so I have one copy of the stored procedure with the prefix and the other one without the prefix. To make sure I made the test on equal conditions I run both of them with a cold memory (after scaling up and down the service tier) and after clearing the procedure cache.

    The elapsed execution time of the stored procedure with or without the the prefix was consistently 77ms or 78 ms.

    Based on my limited test the performance impact of using "sp_" prefix that we see on SQL Server instances, does not apply on Azure SQL Database.

    0 comments No comments

  2. Oury Ba-MSFT 18,601 Reputation points Microsoft Employee
    2021-06-11T23:32:40.61+00:00

    Hello @John Couch Thank you for posting your question. It is, Azure SQL DB is built on the same engine as SQL Server.
    Find more information in this document. Please accept answer if it helpful
    Regards,
    Oury


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.