[thelist] Super Slow Query

Jason Handby jason.handby at corestar.co.uk
Thu Jul 5 13:00:32 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.

Do you have an index on the region_id column?



Jason



More information about the thelist mailing list