Answered by:
FormView DataBind is slow

Question
-
User-1865833014 posted
I'm having a difficult time figuring out why a simple DataBind method is very slow
The datasource calls a stored procedure on our MS Sql server. When calling this directly on the server it executes in less than a second (it's just looking up one table, where there is a key and index on IdentID column). The stored procedure will return 1 row with 41 columns, where the largest one is nvarchar(500), most other columns are int or real
In my code behind file I have added some performance logging on each method being called (being and end of method), with how much time has passed between each of these logs
When the user clicks on something, it will trigger a method in code behind that will call DataBind (with a perfomance log). I then have a OnDataBound on ddlSfbSP_status where when it is activated it will again log time taken. The time from calling DataBind to OnDataBound is triggered varies 5-20 seconds. This only happens on production, where the website and sql server are two different servers, but both servers are only using a few % cpu
I have used the SQL Server Profiler to see what happens
I'm using this exact "code setup" on multiple pages, but the problem is only seen on one page. Any ideas on how to debug this?
Aspx page:
<asp:FormView ID="frmStatusProposal" runat="server" DefaultMode="Edit" CssClass="FormView_Css" DataSourceID="sqlStatusProposalDetail" Width="100%" OnDataBound="SetUValueAdditionDetailAndProposal"> <EditItemTemplate> <asp:HiddenField ID="LabelID" runat="server" Value='<%# Bind("LabelID") %>' /> <asp:HiddenField ID="BuildID" runat="server" Value='<%# Bind("BuildID") %>' /> <asp:HiddenField ID="IdentID" runat="server" Value='<%# Bind("IdentID") %>' /> <asp:HiddenField ID="hidIdentID_p" runat="server" Value='<%# Bind("IdentID_p") %>' /> <asp:HiddenField ID="hidebf" runat="server" Value='<%# Bind("ebf") %>' /> <asp:HiddenField ID="hfIdentSeebClassification" runat="server" Value='<%# Eval("SEEBClassification") %>' /> <asp:HiddenField ID="hfBaseStm" runat="server" Value='<%# Bind("BaseStm") %>' /> <asp:HiddenField ID="hfImproveStm" runat="server" Value='<%# Bind("ImproveStm") %>' /> <table cellpadding="0" cellspacing="0" border="0" style="width: 98%; border-collapse: collapse;"> <tr style="vertical-align: top;"> <td style="width: 49%; padding: 3px"> <div class="divhead" id="div1" runat="server" style="width: 100%;"> <span>Status</span></div> <table cellpadding="2" cellspacing="0" border="0" style="width: 100%;" class="ekpro_panel_box"> <tr id="tr_SfbSP_status" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="SfbGroupLabel" runat="server" Text="Type" />: </td> <td colspan="2"> <asp:DropDownList runat="server" ID="ddlSfbSP_status" AutoPostBack="True" CssClass="ekpro_txt ekpro_field_Large DoNotMark" DataSourceID="sql1" DataTextField="id" DataValueField="grpid" SelectedValue='<%# Bind("sfbgrp") %>' OnSelectedIndexChanged="StatusType_SelectedIndexChanged" onchange="if(!isValid()) return false; inputGray(this);" OnDataBound="StatusType_OnDataBound" /> <ekpro:HelpTip ID="HelpTip1" runat="server" typeId="3" fieldName="group" /> </td> </tr> <tr class="ekpro_std tblrowalt"> <td> <asp:Label runat="server" Text="Bygningsdel" />: </td> <td colspan="2"> <asp:DropDownList ID="ddlStatusBaseStm" runat="server" CssClass="ekpro_txt ekpro_field_Large DoNotMark" AutoPostBack="true" Enabled='<%#Not isNewBuild %>' DataSourceID="sqlBaseStm" DataTextField="text" DataValueField="BaseStm" OnSelectedIndexChanged="ddlStatusBaseStm_SelectedIndexChanged" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip15" runat="server" typeId="3" fieldName="buildingpart" /> </td> </tr> <tr class="ekpro_std tblrowalt"> <td> <asp:Label ID="idLabel" runat="server" Text="Beskrivelse" />: </td> <td colspan="2"> <asp:TextBox ID="idTextBox" runat="server" CssClass="ekpro_txt ekpro_field_Large DoNotMark" Text='<%# Bind("id") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip2" runat="server" typeId="3" fieldName="buildingpart_text" /> </td> </tr> <tr class="ekpro_std tblrowalt"> <td> <asp:Label ID="areaLabel" runat="server" Text="Areal, m²" />: </td> <td colspan="2"> <asp:TextBox ID="areaTextBox" runat="server" CssClass="validate areal area ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("area") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip3" runat="server" typeId="3" fieldName="area" /> </td> </tr> <tr id="tr_uValue" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="uLabel" runat="server" Text="u-værdi" />: </td> <td> <asp:TextBox ID="uTextBox" runat="server" CssClass="validate u ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("u") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip4" runat="server" typeId="3" fieldName="u" /> </td> <td class="remove" runat="server" id="additionToUValue_Detail">Tillæg: 0,00 </td> </tr> <tr id="tr_additionToUValue_GroundDetail1" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="GroundFoundationLabelDetail" runat="server" Text="Skillevægsfund." />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_GroundFoundationDetail" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("GroundFoundationid") %>' OnTextChanged="CalculateUValueAdditionDetail" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_GroundFoundation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_GroundDetail2" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="GroundInsulationLabelDetail" runat="server" Text="Iso. i gulv" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_GroundInsulationDetail" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("GroundInsulationId") %>' OnTextChanged="CalculateUValueAdditionDetail" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_GroundInsulation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_basementDetail1" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="BasementFoundationLabelDetail" runat="server" Text="Skillevægsfund." />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_basementFoundationDetail" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("BasementFoundationid") %>' OnTextChanged="CalculateUValueAdditionDetail" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_basementFoundation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_basementDetail2" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="BasementInsulationLabelDetail" runat="server" Text="Iso. i gulv" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_basementInsulationDetail" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("BasementInsulationId") %>' OnTextChanged="CalculateUValueAdditionDetail" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_basementInsulation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_hollowWallDetail1" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="HollowWallLabelDetail" runat="server" Text="Isolering i fals" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_HollowWallPerimeterDetail" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("HollowWallPerimeterId") %>' OnTextChanged="CalculateUValueAdditionDetail" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" > <asp:ListItem Text="" Value="-1"></asp:ListItem> <asp:ListItem Text="Ja" Value="1"></asp:ListItem> <asp:ListItem Text="Nej" Value="2"></asp:ListItem> <asp:ListItem Text="Ingen vinduer" Value="3"></asp:ListItem> </asp:DropDownList> </td> </tr> <tr id="tr_additionToUValue_hollowWallDetail2" runat="server" class="ekpro_std tblrowalt"> <td> <asp:Label ID="HollowWallOuterWallAreaLabelDetail" runat="server" Text="Murhulsp./yv" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_HollowWallOuterWallAreaDetail" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("HollowWallOuterWallAreaId") %>' OnTextChanged="CalculateUValueAdditionDetail" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_hollowWallOuterWallArea" DataTextField="text" DataValueField="id" /> </td> </tr> <tr class="ekpro_std tblrowalt"> <td> <asp:Label ID="has_bLabel" runat="server" Text="b-faktor" />: </td> <td colspan="2"> <asp:TextBox ID="has_bTextBox" runat="server" CssClass="validate b ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("has_b") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip5" runat="server" typeId="3" fieldName="has_b" /> </td> </tr> <tr class="ekpro_std tblrowalt"> <td> <asp:Label ID="td_inLabel" runat="server" Text="Dim. ind:" Visible='<%# isNewBuild %>' /> </td> <td colspan="2"> <asp:TextBox ID="TextBox1" runat="server" Visible='<%# isNewBuild %>' CssClass="validate td ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("td_in") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip24" runat="server" Visible='<%# isNewBuild %>' typeId="3" fieldName="td_in" /> </td> </tr> <tr class="ekpro_std tblrowalt"> <td> <asp:Label ID="td_outLabel" runat="server" Text="Dim. ud:" Visible='<%# isNewBuild %>'/> </td> <td colspan="2"> <asp:TextBox ID="TextBox2" runat="server" Visible='<%# isNewBuild %>' CssClass="validate td ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("td_out") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip25" runat="server" Visible='<%# isNewBuild %>' typeId="3" fieldName="td_out" /> </td> </tr> </table> </td> <td style="width: 2%;"> </td> <td style="width: 49%;"> <div class="divhead" id="div2" runat="server" style="width: 100%; padding-top: 2px;"> <span>Forslag</span> <asp:ImageButton ImageAlign="AbsMiddle" Visible="false" Style="margin: 0 0 0 4; float: none;" ID="add_p" runat="server" ImageUrl="../images/add.png" ToolTip="½" OnClick="btnAddProposal_Clicked" /> </div> <asp:Panel ID="pnlProposal" runat="server" Visible="false"> <table cellpadding="2" cellspacing="0" border="0" style="width: 100%;" class="ekpro_panel_box"> <tr id="tr_SfbSP_proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="Label1" runat="server" Text="Type" />: </td> <td colspan="2"> <asp:DropDownList runat="server" ID="ddlSfbSP_proposal" AutoPostBack="True" CssClass="ekpro_txt ekpro_field_Large DoNotMark" DataSourceID="sql1" DataTextField="id" DataValueField="grpid" SelectedValue='<%# Bind("sfbgrp_p") %>' OnSelectedIndexChanged="ProposalType_SelectedIndexChanged" onchange="if(!isValid()) return false; inputGray(this);" OnDataBound="ddlSfbSP_proposal_Changed" /> <ekpro:HelpTip ID="HelpTip6" runat="server" typeId="3" fieldName="group" /> </td> </tr> <tr id="tr_improve_proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label runat="server" Text="Forslag" />: </td> <td colspan="2"> <asp:DropDownList ID="ddlImproveStm" runat="server" CssClass="ekpro_txt ekpro_field_Large DoNotMark" AutoPostBack="true" DataSourceID="sqlImproveStm" DataTextField="text" DataValueField="ImproveStm" OnSelectedIndexChanged="ddlImproveStm_SelectedIndexChanged" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip16" runat="server" typeId="3" fieldName="improvement" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label runat="server" Text="Forbedring" />: </td> <td colspan="2"> <asp:TextBox ID="txtImprovement" runat="server" CssClass="ekpro_txt ekpro_field_Large DoNotMark" Text='<%# Bind("improvement") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip7" runat="server" typeId="3" fieldName="improvement_text" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="area_pLabel" runat="server" Text="Areal, m²" />: </td> <td colspan="2"> <asp:TextBox ID="area_pTextBox" runat="server" CssClass="validate areal area ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("area_p") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip8" runat="server" typeId="3" fieldName="area" /> </td> </tr> <tr id="tr_u_pValue" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="u_pLabel" runat="server" Text="u-værdi" />: </td> <td> <asp:TextBox ID="u_pTextBox" runat="server" CssClass="validate u ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("u_p") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip9" runat="server" typeId="3" fieldName="u" /> </td> <td id="additionToUValue_DetailProposal" runat="server" class="remove"> Tillæg: 0,00 </td> </tr> <tr id="tr_additionToUValue_GroundDetail1Proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="GroundFoundationLabelDetailProposal" runat="server" Text="Skillevægsfund." />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_GroundFoundationDetailProposal" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("GroundFoundationid_p") %>' OnTextChanged="CalculateUValueAdditionDetailProposal" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_GroundFoundation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_GroundDetail2Proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="GroundInsulationLabelDetailProposal" runat="server" Text="Iso. i gulv" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_GroundInsulationDetailProposal" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("GroundInsulationId_p") %>' OnTextChanged="CalculateUValueAdditionDetailProposal" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_GroundInsulation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_basementDetail1Proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="BasementFoundationLabelDetailProposal" runat="server" Text="Skillevægsfund." />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_basementFoundationDetailProposal" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("BasementFoundationid_p") %>' OnTextChanged="CalculateUValueAdditionDetailProposal" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_basementFoundation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_basementDetail2Proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="BasementInsulationLabelDetailProposal" runat="server" Text="Iso. i gulv" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_basementInsulationDetailProposal" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("BasementInsulationId_p") %>' OnTextChanged="CalculateUValueAdditionDetailProposal" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_basementInsulation" DataTextField="text" DataValueField="id" /> </td> </tr> <tr id="tr_additionToUValue_hollowWallDetail1Proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="HollowWallLabelDetailProposal" runat="server" Text="Isolering i fals" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_HollowWallPerimeterDetailProposal" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("HollowWallPerimeterId_p") %>' OnTextChanged="CalculateUValueAdditionDetailProposal" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" > <asp:ListItem Text="" Value="-1"></asp:ListItem> <asp:ListItem Text="Ja" Value="1"></asp:ListItem> <asp:ListItem Text="Nej" Value="2"></asp:ListItem> <asp:ListItem Text="Ingen vinduer" Value="3"></asp:ListItem> </asp:DropDownList> </td> </tr> <tr id="tr_additionToUValue_hollowWallDetail2Proposal" runat="server" class="ekpro_std tblrowproposal"> <td> <asp:Label ID="HollowWallOuterWallAreaLabelDetailProposal" runat="server" Text="Murhulsp./yv" />: </td> <td colspan="2"> <asp:DropDownList ID="ddl_additionToUValue_HollowWallOuterWallAreaDetailProposal" runat="server" CssClass="validate ekpro_txt ekpro_field_Medium DoNotMark" SelectedValue='<%# Bind("HollowWallOuterWallAreaId_p") %>' OnTextChanged="CalculateUValueAdditionDetailProposal" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" DataSourceID="sql_hollowWallOuterWallArea" DataTextField="text" DataValueField="id" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="slope_pLabel" runat="server" Text="b-faktor" />: </td> <td colspan="2"> <asp:TextBox ID="has_b_pTextBox" runat="server" CssClass="validate b ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("has_b_p") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip10" runat="server" typeId="3" fieldName="has_b" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="td_inLabel2" runat="server" Text="Dim. ind:" Visible='<%# isNewBuild %>' /> </td> <td colspan="2"> <asp:TextBox ID="TextBox3" runat="server" Visible='<%# isNewBuild %>' CssClass="validate td ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("td_in_p") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip26" runat="server" Visible='<%# isNewBuild %>' typeId="3" fieldName="td_in" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="td_outLabel2" runat="server" Text="Dim. ud:" Visible='<%# isNewBuild %>'/> </td> <td colspan="2"> <asp:TextBox ID="TextBox4" runat="server" Visible='<%# isNewBuild %>' CssClass="validate td ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("td_out_p") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip27" runat="server" Visible='<%# isNewBuild %>' typeId="3" fieldName="td_out" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="CostDKKLabel" runat="server" Text="Pris, kr./m²" />: </td> <td colspan="2"> <asp:TextBox ID="CostDKKTextBox" runat="server" CssClass="validate int ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("CostM2DKK") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip11" runat="server" typeId="3" fieldName="cost" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="LifeSpanLabel" runat="server" Text="Levetid, år" />: </td> <td colspan="2"> <asp:TextBox ID="txtLifeSpan" runat="server" CssClass="validate int ekpro_txt ekpro_field_Small DoNotMark" Text='<%# Bind("LifeSpan") %>' OnTextChanged="AutoSave" AutoPostBack="true" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip12" runat="server" typeId="3" fieldName="lifespan" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="GroupSeebLabel" runat="server" Text="Knyttes til" />: </td> <td colspan="4"> <asp:DropDownList ID="GroupSeebDropDownList" runat="server" CssClass="ekpro_txt ekpro_field_Large DoNotMark" DataSourceID="sql_tabSeebCodes" DataTextField="text" DataValueField="classification" SelectedValue='<%# Bind("GroupSeeb") %>' AutoPostBack="true" OnSelectedIndexChanged="ProposalGroupChanged" OnDataBound="ProposalGroupBound" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip13" runat="server" typeId="3" fieldName="groupseeb" /> </td> </tr> <tr class="ekpro_std tblrowproposal"> <td> <asp:Label ID="GroupNumberLabel" runat="server" Text="Gruppe" />: </td> <td colspan="4"> <asp:DropDownList ID="GroupNumberDropDownList" runat="server" CssClass="ekpro_txt ekpro_field_Small DoNotMark" SelectedValue='<%# Bind("GroupNumber") %>' DataSourceID="sql_spGroupnumbers" DataTextField="name" DataValueField="id" AutoPostBack="true" OnSelectedIndexChanged="ProposalGroupChanged" OnDataBound="ProposalGroupBound" onchange="if(!isValid()) return false; inputGray(this);" /> <ekpro:HelpTip ID="HelpTip14" runat="server" typeId="3" fieldName="groupnumber" /> </td> </tr> </table> </asp:Panel> </td> </tr> </table> </EditItemTemplate> </asp:FormView>
Code:
' A click from user triggers this method
private sub ShowDialog()
' Each method called in code behind is using PerformanceTimer at the start and end, so I know which methods are called in which order
PerformanceTimer.logEvent("Start ShowDialog()", 2)
frmStatusProposal.DataBind()
PerformanceTimer.logEvent("End ShowDialog()", 2)
end sub
Protected Sub StatusType_OnDataBound(sender As Object, e As EventArgs)
PerformanceTimer.logEvent("Start StatusType_OnDataBound()", 2) ' This one shows 5-20 seconds has passed since PerformanceTimer was used
' Do some work
PerformanceTimer.logEvent("End StatusType_OnDataBound()", 2)
End SubTuesday, October 8, 2019 10:36 AM
Answers
-
User-1865833014 posted
I believe I found a solution, but I'm not sure why this solution would work
In the stored procedure I should add the following at the top
SET ARITHABORT ON
GOReading about what it does, I can't see a connection, but now we're down to ~1 second execution time
EDIT:
What happened? I clicked reply, but for some reason it replaced all content of my original message
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, October 8, 2019 12:18 PM -
User288213138 posted
Hi Adagio_Botjek,
Client applications setting ARITHABORT to OFF by default, if you enabled the ARITHABORT its will increase the application performance.
You can refer to below links:https://docs.microsoft.com/en-us/sql/t-sql/statements/set-arithabort-transact-sql?redirectedfrom=MSDN&view=sql-server-2017
http://www.sommarskog.se/query-plan-mysteries.html
Best regards,
Sam
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, October 9, 2019 8:01 AM
All replies
-
User-1865833014 posted
I believe I found a solution, but I'm not sure why this solution would work
In the stored procedure I should add the following at the top
SET ARITHABORT ON
GOReading about what it does, I can't see a connection, but now we're down to ~1 second execution time
EDIT:
What happened? I clicked reply, but for some reason it replaced all content of my original message
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, October 8, 2019 12:18 PM -
User753101303 posted
Hi,
You just changed this option or you recompiled the query plan? Could it be https://www.brentozar.com/archive/2013/06/the-elephant-and-the-mouse-or-parameter-sniffing-in-sql-server/ ?
ie in short sometimes the query plan created first can be not suitable to later queries (on tables as well for example you have a small table so SQL Server decides to read all data rather than using an index and then you add tons of rows and the old plan is still use while another one would be better).
Tuesday, October 8, 2019 1:41 PM -
User-1865833014 posted
Hi
I didn't change any options or recompiled the query plan. I'm not sure what happened, a week ago it was running fine, but one day it just went slow... very slow
Interesting read, I have never heard of this before. Thanks for the tip, I'll look into it and see if it will help even further
Wednesday, October 9, 2019 6:16 AM -
User288213138 posted
Hi Adagio_Botjek,
Client applications setting ARITHABORT to OFF by default, if you enabled the ARITHABORT its will increase the application performance.
You can refer to below links:https://docs.microsoft.com/en-us/sql/t-sql/statements/set-arithabort-transact-sql?redirectedfrom=MSDN&view=sql-server-2017
http://www.sommarskog.se/query-plan-mysteries.html
Best regards,
Sam
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, October 9, 2019 8:01 AM -
User-1865833014 posted
Hi Sam
Thanks for those links, that helps a lot in understanding the issue
Wednesday, October 9, 2019 8:51 AM