Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 indexes

Author  Topic 

nandan
Starting Member

10 Posts

Posted - 2007-09-13 : 15:16:34
Hi There

I wanna know how the indexes work on the query
Let's say u got table 1 which is base table and table2 which is a temporary table and
u r joining those two tables and inserting data to temp tables from
base tables and from that temp table
we r retreiving the data and inserting into another base table
so how the indexes are useful.
One more thing which is more confusing to me is that
When we execute a stored proc how the cost is estimated:
B'cos one query say's cost is 0,query 2 says 28%,query 3 says 72%,query 4 says 0% and the whole adds upto 100% but how can we tune the query and reduce the cost

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-13 : 15:22:57
http://www.sql-server-performance.com/tips/optimizing_indexes_general_p1.aspx

cost is not a good parameter to look at in sql server 2000. It simply doesn't work well.
your primary goal should be to minimize reads.
you can see those by setting
SET STATISTICS IO ON

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

nandan
Starting Member

10 Posts

Posted - 2007-09-13 : 16:24:50
Hi There
I tried using Statistics IO ON
but i want to know when u execute the query it will display u
cpu time elasped time and duration time
which are the options that need to be considered
and if u use execution plan
what are the options that need to be considered
like estimated rows,actual rows, index seek, index scan and joins
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-13 : 18:19:49
"which are the options that need to be considered"

I only look at the Scan Count and the Logic I/O. I make experiments to try to lower these figures as much as possible.

I also look at the Query Plan and see whether there are Scans instead of Seeks and so on, but that takes a bit more knowledge, and the two counts above will do in most cases.

If those two figures are unacceptably high then you can always post your query here and ask for some specific help.

Kristen
Go to Top of Page
   

- Advertisement -