execution plan

execution plan

Post by Rahul Chatterje » Tue, 17 Feb 2004 17:47:01



Hello All

Can anyone tell me a little more about the execution plan. I am a little
confused by the explanation on the SDK. I was analyzing the execution plan
option to find out ways to speed up my queries which use cursors. The
queries are being generated of tables that are properly indexed but the
actual execution is taking a significant amount of time as there is a lot of
processing that is being done on the server end.

Can anyone give me any ideas in general as to how to speed the queries up. A
brief idea about the query.

        Select info. into a cursor
        for each item in the cursor
            perform a select
            perform multiple computations into temp variables
            perform updates on tables
        Repeat

Can anyone give me some idea about what other constructs  other than cursors
can be used that allows processing in a loop and not use as much overhead?
Can anything be done on the DB administration level that speeds this query
up?

Thanks

 
 
 

execution plan

Post by Louis Davidso » Tue, 17 Feb 2004 19:19:00


Absolutely the best advice would be to not use looping constructs unless it
is absolutely necessary.  I don't know what your multiple computations are,
but I expect they could probably be written into a single expression, and if
not, they could definitely be written into a user defined function.  Either
of these will be considerably faster than a cursor in MOST cases.  Can you
post the problem you are trying to solve.

If cursors are the ONLY way, then just make sure you are using a read only,
forward only cursor type.

--
----------------------------------------------------------------------------
-----------

Compass Technology Management

Pro SQL Server 2000 Database Design
http://www.apress.com/book/bookDisplay.html?bID=266

Note: Please reply to the newsgroups only unless you are
interested in consulting services.  All other replies will be ignored :)


Quote:> Hello All

> Can anyone tell me a little more about the execution plan. I am a little
> confused by the explanation on the SDK. I was analyzing the execution plan
> option to find out ways to speed up my queries which use cursors. The
> queries are being generated of tables that are properly indexed but the
> actual execution is taking a significant amount of time as there is a lot
of
> processing that is being done on the server end.

> Can anyone give me any ideas in general as to how to speed the queries up.
A
> brief idea about the query.

>         Select info. into a cursor
>         for each item in the cursor
>             perform a select
>             perform multiple computations into temp variables
>             perform updates on tables
>         Repeat

> Can anyone give me some idea about what other constructs  other than
cursors
> can be used that allows processing in a loop and not use as much overhead?
> Can anything be done on the DB administration level that speeds this query
> up?

> Thanks