I have inherited a new system and I am trying to make some improvements to the data. I am trying to improve this table and seem to be unable to understand my findings.
I have the following table structure:
CREATE TABLE [dbo].[Calls]( [CallID] [varchar](8) NOT NULL PRIMARY KEY, [RecvdDate] [varchar](10) NOT NULL, [yr] [int] NOT NULL, [Mnth] [int] NOT NULL, [CallStatus] [varchar](50) NOT NULL, [Category] [varchar](100) NOT NULL, [QCall] [varchar](15) NOT NULL, [KOUNT] [int] NOT NULL)
This table contains about 220 thousand records. I need to return all records whose date is greater than a certain date. In this case, 12/1/2009. This query will return about 66 thousand records, and it will take about 4 seconds to start. From past systems that I worked on, this seems high. Especially considering how few records there are in the table. Therefore, I would like to bring this time.
So, I wonder what would be good ways to bring this to an end? I tried to add a date column to the table and convert the row date to the actual date column. Then I added an index to this column, but the time remained the same. Given that there are not many records, I can see how a table scan can be fast, but I would think that an index could shorten the time.
I also considered simply querying the columns of the month and year. But I have not tried it yet. And I would like, if possible, to leave it in the "Date" field. But if not, I can change it.
Any help is appreciated.
EDIT: here is the query I'm trying to run and check the speed of the table. I usually expose the columns, but for simplicity I used *:
SELECT * FROM _FirstSlaLevel_Tickets_New WHERE TicketRecvdDateTime >= '12/01/2009'
EDIT 2: So I mentioned that I was trying to create a table with a date column containing the recvddate data, but as a date, not varchar. This is what the TicketRecvdDateTime column is in the query above. The original query that I run against this table is:
SELECT * FROM Calls WHERE CAST(RecvdDate AS DATE) >= '12/01/2009'