I'm using SQL Server 2005 Express, and I'm running into a strange issue. I have a table called "DailyPrice" that has about 24 million records (I was able to make this table thanks to all your help in this thread: http://stackoverflow.com/questions/1983611/sql-server-2005-slows-down-as-i-keep-adding-rows)
Now, I'm running a different fancy function in VB.NET where I need to get a list of entries based on a ticker symbol (just 1), and I need them organized from oldest to newest.
This query works:
SELECT Ticker, DateStamp, ClosePrice
FROM DailyPrice
WHERE (Ticker = 'DD')
This one is either agonizing slow, or I get a timeout error:
SELECT Ticker, DateStamp, ClosePrice
FROM DailyPrice
WHERE (Ticker = 'DD')
ORDER BY DateStamp
The fields Ticker and DateStamp are my primary index, in case that matters. Why does this slow down when i use ORDER BY? A couple hours ago the problem query ran speedily and fine, but only once - and now I'm plagued by timeouts.