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.
Author |
Topic |
nandan
Starting Member
10 Posts |
Posted - 2007-09-13 : 15:16:34
|
Hi ThereI wanna know how the indexes work on the queryLet'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 tablewe r retreiving the data and inserting into another base tableso 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.aspxcost 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 settingSET STATISTICS IO ON_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
nandan
Starting Member
10 Posts |
Posted - 2007-09-13 : 16:24:50
|
Hi ThereI tried using Statistics IO ONbut i want to know when u execute the query it will display u cpu time elasped time and duration timewhich 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 |
 |
|
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 |
 |
|
|
|
|