March 5, 2008 at 8:01 pm
Would it be the time itself is pretty much an unique value already?
So it don't produce a good index on it?
March 6, 2008 at 3:53 am
Sorry Michaell,
I dont understand the question here...
GAJ
Gregory A Jackson MBA, CSM
March 6, 2008 at 4:07 am
Michaell (3/5/2008)
Would it be the time itself is pretty much an unique value already?So it don't produce a good index on it?
Absolutely not... the more unique a value it is, the better an index can be made from it.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 6, 2008 at 9:12 am
Just a test... please ignore...
--Jeff Moden
Change is inevitable... Change for the better is not.
March 6, 2008 at 11:00 am
Just another test... please ignore.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 6, 2008 at 11:23 am
Greg,
How can we improve the following query?
-------------------------
--------------------------
WHERE
filter 1
AND filter 2
AND CONVERT(DATETIME,A.DateValue) BETWEEN (GetDate()-30) AND (GetDate()+30)
Column DateValue in table A has datatype (varchar/nvarchar) but datetime.
Thanks in advance.
Rishi
March 6, 2008 at 11:33 am
Many times we need to use function 'MAX' in 'Select' clause specially for dates. Does anyone has a thought on different approach.
For example
select max(a.closedate) as closedate, a.offerid
from a inner join b on a.id =b.id
inner join c on b.xx = c.xx
group by a.offerid
Thanks,
Rishi
March 6, 2008 at 12:29 pm
Rishi Girdhar (3/6/2008)
Many times we need to use function 'MAX' in 'Select' clause specially for dates. Does anyone has a thought on different approach.For example
select max(a.closedate) as closedate, a.offerid
from a inner join b on a.id =b.id
inner join c on b.xx = c.xx
group by a.offerid
Thanks,
Rishi
We did a series of tests and found, depending on how you do your indexing, TOP actually works a bit better than MAX. You have to include an ORDER BY and get the ASC/DESC right.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
March 6, 2008 at 11:46 pm
Thanks Grant,
I will try with TOP and ORDER BY and see the difference.
Thanks again,
Rishi
Viewing 9 posts - 91 through 98 (of 98 total)
You must be logged in to reply to this topic. Login to reply