Click here to Skip to main content
15,883,999 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a table with 30000 rows in it , and i make an copy with data of this table .

i have one clustered index on primary key column and three other indexes on this table

when i am execut any query on theses indexed column behalf ..i have seen no improvement on time of execution . i have tried many query ... time taken for both table (with and without indexs with same data) are same . (i tried using execution plan for time taken also)

Can any one suggest what s the problem ...how to use them ?
Posted

some tips...

you should apply index on column which you are using for WHERE clause
and if you are using joins then make sure index is applied to that table's columns' too

check execution plan if table with more data should not be scan it should be seek

Do not include unnecessary columns in select list

Happy Coding!
:)
 
Share this answer
 
v2
Comments
GDdixit 4-Jan-14 5:57am    
YES DEAR , I DO THE SAME AS U TOLD HERE ...

BUT THE TIME TAKEN IS SAME IN BOTH CONDITION ...
IS IT RIGHT THAT I AM CHECKING THE ESTIMATED SUBTREE COST IN EXECUTION PLAN ?
Christian Graus 4-Jan-14 6:01am    
Run the SQL, and see if it's faster. The cost in the execution plan is a %, not a time.
A clustered index is normally a bad idea if you have secondary indexes, because the secondary indexes cannot point to ROWIDs in the heap, they have to point to the clustered index.
This means that for EVERY row it scans in the secondary index, it needs to make an index seek in the clustered index, making it inefficient when querying many rows.
 
Share this answer
 
A clustered index is a BAD idea if your data is often deleted or changed.
 
Share this answer
 
Comments
GDdixit 4-Jan-14 6:09am    
SO THAN WE CAN USE UNCLUSTERED INDEX ON THE COLUMN THAT ARE NOT FREQUENTLY CHANGED ?
Christian Graus 4-Jan-14 6:14am    
You can use it whenever you want, but because it means all the data is stored in the cluster, it makes deletes and edits slow and expensive, so not a great idea.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900