Re: Slow execution of a stored procedure

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: pep_castefa (pepcastefa_at_discussions.microsoft.com)
Date: 02/17/05


Date: Thu, 17 Feb 2005 01:01:03 -0800

I have discovered something... the first time I execute the SP the variable
'physical reads' is high (a lot of reads from physical disk). All the other
executions have this variable to 0. Does that mean it has all the 1.300.000
rows in memory? If so, is there any way to initialize this table in memory
the first time SQL Server executes? (there is an ugly way, which would be
executing the SP the first time SQL starts just to make it bring the table to
memory...)
By the way, Uri... the table doesn't have many columns. I dont think that is
the problem.
What I have seen in the execution plan is that it first uses a clustered
index seek, then it filters the values. The clustered index seek is because
the SP I wrote for this post was not really the one Im using. The one Im
using in production has a JOIN with another table. What I dont know is if it
would be better to do the filter first (passing from 1.300.000 registers to
no more than 50), using the index, and then do the clustered index seek (to
do the join with the other table). Is there any way to tell SQL Server to do
the filtering first and then the JOIN?



Relevant Pages

  • Re: CICS and COBOL reentrancy was Re: Further discussion on "Something has to be maintained" and lac
    ... branched, based on the progress indicator, which was set immediately ... different in that the next code to execute could be enqueued against the ... EIBCALEN indicates whether this is the first time in, ... at which point the next one comes in with IT's terminal-dependent ...
    (comp.lang.cobol)
  • Re: can I force Page.IsPostBack=false ?
    ... Mark Fitzpatrick wrote: ... Then in the button's click handler you can just call the function directly. ... is being called for the first time. ... Page_Load if to execute as if we are calling the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: can I force Page.IsPostBack=false ?
    ... I want the form to reload as if it ... is being called for the first time. ... Page_Load if to execute as if we are calling the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Dynamic button first click doesnt raise event
    ... "William" wrote: ... I've created a page with only 'n blank table control on it. ... the first time the submit button is ... I need to get the system to execute the code on the first click to avoid ...
    (microsoft.public.dotnet.framework.aspnet)