Friday, March 9, 2012

Method EnumDatabaseMapping on Login SMO object takes 3 minutes

Hi,

The EnumDatabaseMapping call below takes upto 3 minutes on some SQL Servers whereas it takes hardly any time at all on others. What may cause such a long delay?

Regards,
Joginder Nahil
www.starprint2000.com

Private Sub OutputUserMapping(ByVal oLogin As Microsoft.SqlServer.Management.Smo.Login)

Dim colDatabaseMapping() As DatabaseMapping
colDatabaseMapping = oLogin.EnumDatabaseMappings

' Rest of the code has been deleted

End sub

Hi Joginder,

EnumDatabaseMappings is an expensive operation. SMO issues queries that iterate over all databases on the server and stores intermediate results in a temporary table. This might take time for a server with many databases and users, especially if under heavy load.

You can find out more by running SQL Server Profiler and inspecting the queries that are being sent to the server.

Arur Laksberg
SQL Server Team
Microsoft

|||

Hi Artur,

I am inclined to say that 3 minutes is a very long time in computer processing time (BTW my SQL Server is on the same computer as running the application and has 1GB memory + 3.6 Pentium 4 Processor+ there is nothing much else running) to enumerate just three databases AdventureWorks, Pubs and Northwind.

Regards,

Joginder Nahil
www.starprint2000.com

No comments:

Post a Comment