Weird one.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shawn

    #1

    Weird one.

    I have a dataset named "dsMessages " that has a single table. I have a timer
    that runs a query against an SQL db every 5 seconds. At the beginning I have
    it run dsMessages.Clea r(). The first time this runs, it causes a long pause,
    but then it runs fine every time thereafter. I have other datasets in the
    application that seem to do the same thing... Any ideas?


  • Mary Chipman [MSFT]

    #2
    Re: Weird one.

    It's likely the result of the way SQLS handles query execution plan
    caching. The first time a query runs, it takes longer. Subsequent
    executions are faster because the plan is reused. See the topic
    "Execution Plan Caching and Reuse" in SQL Server Books Online for more
    information. One workaround to avoid the first-time perf hit is on
    startup to run those queries in the background so plans are cached and
    available for reuse. This may or may not work depending on the type of
    applicaton you have.

    --Mary

    On Mon, 8 Aug 2005 12:01:27 -0400, "Shawn" <shawn.camner@c cci.org>
    wrote:
    [color=blue]
    >I have a dataset named "dsMessages " that has a single table. I have a timer
    >that runs a query against an SQL db every 5 seconds. At the beginning I have
    >it run dsMessages.Clea r(). The first time this runs, it causes a long pause,
    >but then it runs fine every time thereafter. I have other datasets in the
    >application that seem to do the same thing... Any ideas?
    >[/color]

    Comment

    • Phill.  W

      #3
      Re: Weird one.

      "Shawn" <shawn.camner@c cci.org> wrote in message
      news:OYVDwJDnFH A.2484@TK2MSFTN GP15.phx.gbl...[color=blue]
      > The first time this runs, it causes a long pause, but then it runs
      > fine every time thereafter. I have other datasets in the application
      > that seem to do the same thing...[/color]

      As will just about every other, complex class you ever use or write
      in .Net's Managed Code (although I'm surprised that /more/ than
      one DataSet should do it in the same application).

      It's because the first time you use any [method within a] class, the
      RunTime has to go off, pull the relevant code out of the assembly,
      and pop it through the Just-In-Time "Compiler" (actually, a Linker,
      but what's in a name?) before it can actually execute it. Fortunately,
      it only has to do this once for each method within any running process.

      HTH,
      Phill W.


      Comment

      Working...