MSSQL/PHP: mssql_select_db() takes 2 seconds on certain database
I have just noticed one of my MSSQL databases has slowed down dramatically. The weird thing is, it's the smallest database of them all but it takes the longest to open.
After the database opens using mssql_select_db() it queries fine, but the initial mssql_select_db() takes 2 seconds. What could possibly be causing this?
Database 1 is much larger and has many more tables/rows then Database 2, they are both on the same MSSQL server so it's not a networking issue.
Database 1
Connection/Selecting DB Time: 0.00554800033569
Query Time: 0.035463809967
Database 2 (Slow One)
Connection/Selecting DB Time: 2.40434789658
Query Time: 0.144586801529
Update: When i have "Database 2" open in Server Management Studio. mssql_select_db() seems to run normally, and connects fast see below
Database 1
Connection/Selecting DB Time: 0.00480604171753
Query Time: 0.0346729755402
Database 2 (Slow One)
Connection/Selecting DB Time: 0.00085186958313
Query Time: 0.0340950489044
This is not caused by too many active connections, I have already ruled that out. Any ideas?
Update 2: I'm running PHP Version 5.2.6-1+lenny13 using MSSQL FreeT开发者_如何学JAVADS Library. I am directly connecting via IP not using hostnames so it's not a resolv issue.
Could it be that other processes have open connections to that DB and there are no other available available connections?
I have rebuilt the database and re-imported all the data, that has seemed to fix the problem. It may have just have been database fragmentation this whole time.
精彩评论