473,499 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MSSQL Slow Queries on One Database only all others fine.

3 New Member
Hello Everyone,

I have a strange problem that I cannot seem to solve. I have two server running Windows 2003 MSSQL on one IIS on the other.

Out of the blue I have slow queries that cause asp script timeouts and I cannot figure it out. I have moved some test code to other sites on the server and still have these long delays.

I have tried dropping the tables, then the database entirely and restoring and still slow. I run the same code on my test server at home running both iis and sql on the same server and it is a little slow but not too bad and the test server is a duron 1.6.

Here it is:
Expand|Select|Wrap|Line Numbers
  1. <!-- #include file="adovbs.inc" -->
  2.  
  3. <%
  4.     response.write("<table width=100% border=0>")
  5.     response.write("<tr><td align=left>")
  6.     Set dbconn = Server.CreateObject("ADODB.Connection")
  7.         dbconn.Open database_three
  8.         dbconn.CommandTimeout = 0
  9.     Set group_master = Server.CreateObject("ADODB.Recordset")
  10.     Set section_master = Server.CreateObject("ADODB.Recordset")
  11.     Set document_master = Server.CreateObject("ADODB.Recordset")
  12.         group_master.open "SELECT * FROM group_master",dbconn,adOpenForwardOnly,adLockReadOnly
  13.         Do while not group_master.EOF
  14.             group_number = clng(group_master("group_number"))
  15.             group_title = group_master("group_title")
  16.             group_description = group_master("group_description")
  17.             group_stat = group_master("group_status")
  18.             response.write("<table width=100% border=0>")
  19.             If group_stat = "A" Then response.write("<tr><td align=left colspan=3 CLASS=activegroup>" & group_title & "</td></tr>")
  20.             If group_stat = "O" Then response.write("<tr><td align=left colspan=3 CLASS=obsoletegroup>" & group_title & "</td></tr>")
  21.             response.write("<tr><td align=justify colspan=3 CLASS=groupdescription>" & group_description & "</td></tr>")
  22.             section_master.open "SELECT * FROM section_master where group_number=" & group_number,dbconn,adOpenForwardOnly,adLockReadOnly
  23.             If not section_master.EOF Then
  24.                 Do while not section_master.EOF                        
  25.  
  26.                     sec_no = clng(section_master("section_number"))
  27.                     If section_master("section_status") = "A" Then response.write("<tr><td></td><td align=left colspan=2 class=activesection><font color=black><strong>" & x & ".</strong></font> " & section_master("section_title") & "</td></tr>")                    
  28.                     If section_master("section_status") = "O" Then response.write("<tr><td></td><td align=left colspan=2 class=obsoletesection><font color=black><strong>" & x & ".</strong></font> " & section_master("section_title") & "</td></tr>")                    
  29.                     response.write("<tr><td></td><td align=justify colspan=2 class=sectiondescription><font color=white><strong>" & x & ".</strong></font> " & section_master("section_description") & "</td></tr>")
  30.                     document_master.open "SELECT * FROM document_master where group_number=" & group_number & " and section_number=" & sec_no & " ORDER BY document_seq",dbconn,adOpenForwardOnly,adLockReadOnly
  31.  
  32.                     If not document_master.EOF Then
  33.                         Do while not document_master.EOF
  34.                             If document_master("document_status") = "A" Then response.write("<tr><td></td><td></td><td align=left CLASS=activedocument><font color=black><strong>" & formatnumber(document_master("document_seq"),2) & "</strong></font> " & document_master("document_title") & "</td></tr>")
  35.                             If document_master("document_status") = "O" Then response.write("<tr><td></td><td></td><td align=left CLASS=obsoletedocument><font color=black><strong>" & formatnumber(document_master("document_seq"),2) & "</strong></font> " & document_master("document_title") & "</td></tr>")
  36.                             response.write("<tr><td></td><td></td><td align=left CLASS=documentdescirption><font color=white><strong>" & formatnumber(document_master("document_seq"),2) & "</strong></font> " & document_master("document_details") & "</td></tr>")
  37.                             document_master.MoveNext
  38.                         Loop
  39.                         document_master.Close
  40.                     Else
  41.                         document_master.close
  42.                     End If ' Make sure there are documents to loop thru.
  43.                     section_master.MoveNext
  44.                 Loop    
  45.                 section_master.Close
  46.             Else
  47.                 section_master.Close
  48.             End If ' Make sure there was sections to look at.
  49.  
  50.             group_master.MoveNext
  51.         Loop
  52. response.write("</td></tr></table></td></tr></table>")
  53.         dbconn.Close
  54.     Set dbconn = Nothing
  55.     Set group_master = Nothing
  56.     Set section_master = Nothing
  57.     Set document_master = Nothing
  58.  
  59. %>
  60.  
Keep in mind nothing about my code has changed so it must be something on the server like maybe a security setting or routing issue, I just can't figure out what could have MAGICALLY changed. I am not the only admin on the servers but everyone says they changed nothing. Any help would be GREATLY appreciated.
Nov 12 '07 #1
2 2482
iburyak
1,017 Recognized Expert Top Contributor
Is it possible that you just have more data then before?
Do you have indexes on your tables?
Nov 13 '07 #2
gnomee2
3 New Member
Yeah I do have index's. I also ran the optimizer.

The data has not changed, it is only updated as we add documents and none have been added for a couple of months.

Its not really that much data.
Nov 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3682
by: Arni Snorri Eggertsson | last post by:
Hi I am trying to design an IO subsystem for my SQL Server and for that I need to try and predict IO activity on each table in my MSSQL Database. My idea is to move the hottest tables into...
5
3169
by: Bradley.. .. . . .. .. | last post by:
Requirement: managers can login and only see employee data for the department they manage and any sub-ordinate departments. The departments are in a table that defines a simple tree structure...
29
2088
by: Geoff Jones | last post by:
Hi All I hope you'll forgive me for posting this here (I've also posted to ado site but with no response so far) as I'm urgently after a solution. Can anybody help me? I'm updating a table on...
16
1739
by: davemateer | last post by:
Hi We have a current system: Linux / Apache / PHP4.x talking to Microsoft SQL 2000 Thinking about going to: Windows 2003 / PHP4.x talking to the same Microsoft SQL 2000 box...
12
3909
by: grace | last post by:
i am wondering why my database retrieval becomes too slow...we set up a new server (ubuntu, breezy badger) machine where we transferred all our files from the old server.. Our new server uses Asus...
4
2321
by: ThePhenix | last post by:
Hi everybody, I have recently been doing a conversion for my boss for a access 2000 database (both front and backend) to a MSSQL backend. I finished the conversion today (as quite a lot of the...
1
2651
by: mkepick | last post by:
migrated databases from sybase to mssql, migration exported sybase written queries written with the application build in query tool and imported to mssql databases. all db and tables migrated...
4
2669
by: bfoo75 | last post by:
Hi there, I'm new to this forum, but I've come here quite a bit to find solutions to problems other people have encountered... I'm currently trying to query a database up to 5000 times as fast as...
2
9813
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
0
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.