February 13, 2009 at 8:19 am
Does anyone know if it's faster to do "order by" before creating a clustered index?
ex)
select COLUMN_A, max(COLUMN_B) as COLUMN_B
into TABLE_B
from TABLE_A
group by COLUMN_A
order by COLUMN_A
create unique clustered index COLUMN_A on TABLE_B (COLUMN_A)
Thanks.
February 13, 2009 at 8:28 am
Max (2/13/2009)
Does anyone know if it's faster to do "order by" before creating a clustered index?ex)
select COLUMN_A, max(COLUMN_B) as COLUMN_B
into TABLE_B
from TABLE_A
group by COLUMN_A
order by COLUMN_A
create unique clustered index COLUMN_A on TABLE_B (COLUMN_A)
Thanks.
No. Running the query above prior to creating the clustered index will have no affect at all on the create index statement.
February 13, 2009 at 8:41 am
Lynn Pettis (2/13/2009)
No. Running the query above prior to creating the clustered index will have no affect at all on the create index statement.
Actually won't it slow everything down? I mean not the actual creation of the index itself, but the process.
"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
February 13, 2009 at 8:48 am
What I think he was asking, will the create index run faster after I run the query with the order by first.
If that isn't what the OP meant, he needs to do a better job of explaining his request.
February 13, 2009 at 8:55 am
Lynn Pettis (2/13/2009)
What I think he was asking, will the create index run faster after I run the query with the order by first.If that isn't what the OP meant, he needs to do a better job of explaining his request.
No, you got it right I think. I just wanted to point out that the wasted effort wasn't zero sum, it not only didn't help, it hurt overall. Sorry, I did it in too flippant a way.
"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
February 13, 2009 at 8:57 am
Actually, I think we need an emoticon for sarcism. Know of one?
February 13, 2009 at 9:34 am
I would have to vote for this one.
:Whistling:
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply