[thelist] Super Slow Query

Casey Crookston caseyc at IntelliSoftmn.com
Thu Jul 5 12:45:33 CDT 2007


Hmm.  Something I just discovered when playing around.  Here's the
gridview's data source:


<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:connect_big %>"
        SelectCommand="SELECT ... WHERE ... AND (b.region_id =
@region_id)">
        <SelectParameters>
            <asp:ControlParameter ControlID="drpRegions"
Name="region_id" PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
</asp:SqlDataSource>


Now, if I take out the @region_id and replace it with a hard coded
value, then Bingo!  The reslts are instant.  @region_id is, of course, a
paramater populated from the selected value of the dropdown, drpRegions.
>From looking at that drop down, everything appears to be in order, but
for some reason, when trying to execute this gridview and query at
runtime, it hangs.

Any idea why?

Thanks, Casey






 
-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Anthony Baratta
Sent: Thursday, July 05, 2007 11:57 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] Super Slow Query

You need to start adding timers to you code. Just log the time at
specific locations in your code and see where the slow down is. I would
suspect that the error is not in the query itself. Maybe there is a
looping problem over the record set, or maybe building the  grid view,
or somewhere else. Timers all over the code will tell you that.

-----Original message-----
From: "Casey Crookston" caseyc at IntelliSoftmn.com
Date: Thu, 05 Jul 2007 09:38:42 -0700
To: thelist at lists.evolt.org
Subject: [thelist] Super Slow Query

> Hi All,
> 
>  
> 
> In VS2005  / SQL 2000, I've got a query which continually times out
when
> executed via a web app.  It's a query that generates a report and then
> displays the data in a gridview on a web page.  
> 
>  
> 
> When I copy the query into SQL 2000's query analyzer and execute it,
it
> takes  00:00:01 to run.  And when I go into "Configure Data Source"
> within the SQLDataSource on the page and test the query, it returns a
> set of data almost instantly.
> 
>  
> 
> But, at run time, the page times out every time on this query.
> 
>  
> 
> ?????!
> 
>  
> 
> Casey
> 
>  
> 
>  
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 
-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 



More information about the thelist mailing list