I am using a Telerik RadGrid to display records I get from executing a stored procedure. The records that are returned from the stored procedure are stored in a DataSet which are then bound to the Grid's Data Source property using the following line of code
grid.DataSource=ds["Table"].DefaultView;
grid.DataBind
Depending on a few check boxes clicked on the page the stored procedure will either execute a join or execute a simple SQL query.
The simple query uses a SELECT * Statement
e.g.
SELECT * FROM Table1 WHERE Table1.Key=@Key
wheres the join statement uses a SELECT DISTINCT
e.g.
SELECT DISTINCT Table1.UserKey, Table1.UserName FROM Table1 INNER JOIN Table 2 on Table1.Key=Table2.ParentKey WHERE Table1.UserKey=@UserKey.
Both queries execute in under a second (we tested this SQL Server Management Studio). The SELECT * Statement returns around 300 records and SELECT DISTINCT returns around 200 records.
Even though the SELECT DISTINCT has fewer records it takes around 10-15 seconds more for the page to render than the SELECT * Statement.
We would really appreciate your feedback on this problem.
ASPX For the telerik grid is as follows
<telerik:RadGrid ID="dgSearch" CssClass="RadGrid RadGrid_CSMi" runat="server" Width="730px"
Font-Size="8pt" AllowSorting="True" AllowPaging="True" PageSize="5" AutoGenerateColumns="False"
EnableEmbeddedSkins="false" OnSelectedIndexChanged="dgSearch_SelectedIndexChanged">
<PagerStyle Mode="NextPrevAndNumeric" />
<AlternatingItemStyle BackColor="#C4E1FF" />
<MasterTableView Width="100%" DataKeyNames="AthleteKey">
<Columns>
<tec:GridButtonColumnWithFilteringSorting HeaderText="Full Name" UniqueName="FullName"
SortExpression="FullName" DataTextField="FullName" DataField="FullName" CommandName="Select"
ButtonType="LinkButton" />
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" />
<telerik:GridCheckBoxColumn DataField="Active" HeaderText="Active" ReadOnly="True" />
<telerik:GridBoundColumn DataField="StatusPractice" HeaderText="Practice Status" />
<telerik:GridBoundColumn DataField="StatusGame" HeaderText="Game Status" />
<telerik:GridBoundColumn DataField="ReleaseDate" HeaderText="Release Date" />
</Columns>
</MasterTableView>
<FilterMenu EnableEmbeddedSkins="False" EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
Thanks,
CSMi