A Very slow response when I use 2 or more recordsets in ASP

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default A Very slow response when I use 2 or more recordsets in ASP

    I use ASP + SQL server 2000, one day I noticed that my scripts work
    rather slow... I found that it happens when I use 2 or more queries,
    for example, the following script

    <%
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "server3", "", ""
    Response.Write Now & "<br>"
    sql="SELECT 2 as sample"
    Set RS=Conn.Execute(sql)
    Response.Write Now & "<br>"
    Set RS=Conn.Execute(sql)
    Response.Write Now & "<br>"
    RS.close
    Conn.close
    set RS = nothing
    set Conn = nothing
    %>

    produces the following:

    21.05.2004 18:03:03
    21.05.2004 18:03:03
    21.05.2004 18:03:12

    9 seconds for a simple select?..

    I noticed that if I use

    Conn.CursorLocation = adUseClient

    everything works as before, but I wonder, what could happen to server?
    no hardware or software or quantity of simultaneous users has been
    changed lately. The same script on other IIS works quickly without
    client cursors...
    Dmitry Guest

  2. Similar Questions and Discussions

    1. Slow to no response
      I have an older box running Win2k with CF 5.0 SP 4 Enterprise and JRun 3.1. Its my last box still running 5 that I was leaving alone for all my...
    2. Slow Response
      When I block a word or sentence and ask it to make a change , i.e. bold, change font, color, etc. the response time for that change to be made is...
    3. Slow Response after external connection
      have been experiencing slow response time from my application after someone connects outside the firewall. This then affects everyone inside the...
    4. Slow login response response on TS 03 in AD mixed mode
      We upgraded our NT 4 domain to an AD mixed until we get rid of the NT 4 BDC;s after completing this upgrade users began complaining about how long...
    5. FMP5.5 Application Response... slow!!!
      Anyone who's seen my last few threads will know that I'm having crippling speed problems since upgrading to FMP5.5 from 4.1 I know it's nothing...
  3. #2

    Default Re: A Very slow response when I use 2 or more recordsets in ASP

    Turn on profiler and perfmon and watch what else is going on between select
    1 and select 2. Obviously there is no I/O or contention on the database
    itself, because you're not actually touching any tables or procedures. But
    something is going on that you're not going to be able to explain by code
    alone, I don't think...

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Dmitry" <bohr936@hotmail.com> wrote in message
    news:29cb33c.0405210618.66d9405f@posting.google.co m...
    > I use ASP + SQL server 2000, one day I noticed that my scripts work
    > rather slow... I found that it happens when I use 2 or more queries,
    > for example, the following script
    >
    > <%
    > Set Conn = Server.CreateObject("ADODB.Connection")
    > Conn.Open "server3", "", ""
    > Response.Write Now & "<br>"
    > sql="SELECT 2 as sample"
    > Set RS=Conn.Execute(sql)
    > Response.Write Now & "<br>"
    > Set RS=Conn.Execute(sql)
    > Response.Write Now & "<br>"
    > RS.close
    > Conn.close
    > set RS = nothing
    > set Conn = nothing
    > %>
    >
    > produces the following:
    >
    > 21.05.2004 18:03:03
    > 21.05.2004 18:03:03
    > 21.05.2004 18:03:12
    >
    > 9 seconds for a simple select?..
    >
    > I noticed that if I use
    >
    > Conn.CursorLocation = adUseClient
    >
    > everything works as before, but I wonder, what could happen to server?
    > no hardware or software or quantity of simultaneous users has been
    > changed lately. The same script on other IIS works quickly without
    > client cursors...

    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: A Very slow response when I use 2 or more recordsets in ASP

    You probabally need to set up dome form of Index on the Table.

    You can see whats going on with your queries by entering them into SQL
    Query Analyzer and opening up the Execution plan window, Query->Show
    Execution Plan.

    Now run your query in the analyzer and look at the excution plan.
    Hover your mouse right click on the table and go to manage indexes.

    To know more about indexes try:
    [url]http://www.sql-server-performance.com/query_execution_plan_analysis.asp[/url]
    Sonic Guest

  5. #4

    Default Re: A Very slow response when I use 2 or more recordsets in ASP

    I think the queries are not the matter, because when I run them in
    Query Analyzer, they work quite quickly, I've set up the necessary
    indices.
    The problem appears when I use ASP recordsets, or, for example, open
    the tables in Access using ODBC. the delay doesn't depend on the
    queries, even the simple "SELECT 1" causes the delay.
    I tried to reinstall MDAC 2.8 but it didn't improve the situation.

    [email]liam@liamhughes.com[/email] (Sonic) wrote in message news:<e00ae24f.0405260240.65566c2e@posting.google. com>...
    > You probabally need to set up dome form of Index on the Table.
    >
    > You can see whats going on with your queries by entering them into SQL
    > Query Analyzer and opening up the Execution plan window, Query->Show
    > Execution Plan.
    >
    > Now run your query in the analyzer and look at the excution plan.
    > Hover your mouse right click on the table and go to manage indexes.
    >
    > To know more about indexes try:
    > [url]http://www.sql-server-performance.com/query_execution_plan_analysis.asp[/url]
    Dmitry Guest

  6. #5

    Default Re: A Very slow response when I use 2 or more recordsets in ASP

    Could it be related to:
    [url]http://support.microsoft.com/default.aspx?scid=kb;en-[/url]
    us;235282
    INFO: SQL Server Spawns Additional Connections When You
    Open Multiple ForwardOnly ADO Recordsets

    that would explain why Conn.CursorLocation = adUseClient
    makes it faster.

    9 seconds is still a long time for opening a connection,
    so the problem may be something else.

    (put a resopnse.write now() at the begining so you can see
    how long it takes to open the first connection)

    Good luck

    Mendel Nemanov
    Spotlight Design
    >-----Original Message-----
    >I think the queries are not the matter, because when I
    run them in
    >Query Analyzer, they work quite quickly, I've set up the
    necessary
    >indices.
    >The problem appears when I use ASP recordsets, or, for
    example, open
    >the tables in Access using ODBC. the delay doesn't depend
    on the
    >queries, even the simple "SELECT 1" causes the delay.
    >I tried to reinstall MDAC 2.8 but it didn't improve the
    situation.
    >
    >liam@liamhughes.com (Sonic) wrote in message
    news:<e00ae24f.0405260240.65566c2e@posting.google. com>...
    >> You probabally need to set up dome form of Index on the
    Table.
    >>
    >> You can see whats going on with your queries by
    entering them into SQL
    >> Query Analyzer and opening up the Execution plan
    window, Query->Show
    >> Execution Plan.
    >>
    >> Now run your query in the analyzer and look at the
    excution plan.
    >> Hover your mouse right click on the table and go to
    manage indexes.
    >>
    >> To know more about indexes try:
    >> [url]http://www.sql-server-[/url]
    performance.com/query_execution_plan_analysis.asp
    >.
    >
    Mendel Nemanov Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139