15 pts.
 Optimizing Query
Hi, I am having a table which is having around 170 Columns(Don't blame me but my Developer) and there are only 989 records in the table.I created all sorts of Indexes but still the query (Select * from Table) takes almost 2 mins to display 989 records.I need all the columns to be displayed.Is there any way I can make this query to run faster.Thanks In Advance - Sachin

Software/Hardware used:
ASKED: June 11, 2008  11:30 AM
UPDATED: July 4, 2008  9:18 AM

Answer Wiki:
If you are returning all records adding indexes won't do you any good. A table scan is being done. How much data is in the table? What is the latency between you and the SQL Server?
Last Wiki Answer Submitted:  June 11, 2008  11:12 pm  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 64,520 pts.

 

There is around 1000 records only.and Latency is

Pinging [172.30.5.48] with 32 bytes of data:

Reply from 172.30.5.48: bytes=32 time=218ms TTL=122
Reply from 172.30.5.48: bytes=32 time=218ms TTL=122
Reply from 172.30.5.48: bytes=32 time=221ms TTL=122
Reply from 172.30.5.48: bytes=32 time=218ms TTL=122

 15 pts.

 

Try Select * from Table with (nolock) – if this runs faster then the issue is not indexes etc but locking. If it is still slow try defragmenting table and its indexes. Also such a large number of columns shows lack of normalisation and are you sure you need: Select * from table without restricting which columns or using a where statement to restrict which rows? I would look at the whole design issue and try to improve table and query structure.

 210 pts.