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 |
|
tc
Starting Member
11 Posts |
Posted - 2006-02-14 : 09:44:02
|
| When I run the following query it runs in under a second:SELECTconvert(varchar, HistDate, 101) as DateFROM dbo.viewCrewDataL1WHERE HistDate >= '01/01/2006'order by histdateBut when I add " and Crew = 'H' " to the where clause it takes 10 seconds, any ideas on how to speed this up? |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2006-02-14 : 10:44:39
|
| Add crew as a second column of the index on histDate if both columns are from the same table and performance of this query is critical |
 |
|
|
tc
Starting Member
11 Posts |
Posted - 2006-02-14 : 10:50:19
|
| I apologize for my ignorance but I'm new to all of this, do you mean add crew to the group by and order by clauses? |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2006-02-14 : 10:58:50
|
| No, I mean add crew in the index. |
 |
|
|
tc
Starting Member
11 Posts |
Posted - 2006-02-14 : 11:04:26
|
| I'm getting the data from a view. |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2006-02-14 : 11:16:46
|
Which is query based on one or more tables and you can create index on tables. You can even create index on view but it is too advanced topic at the moment for you. So run sp_helptext viewCrewDataL1 and see if both histDate and crew come from the same table. |
 |
|
|
|
|
|