Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


File Groups


File Groups

Author
Message
Toby White
Toby White
Mr or Mrs. 500
Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)Mr or Mrs. 500 (503 reputation)

Group: General Forum Members
Points: 503 Visits: 639
I knew the data would be with the clustered index, but I wasn't sure whether the inner reference or outer reference would win, or whether an error would be thrown. I spent 10 minutes setting up a test environment to make sure. I would have been guessing among my three options otherwise.
BudaCli
BudaCli
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1166 Visits: 598
GabyYYZ (10/19/2009)
SanjayAttray (10/19/2009)
Very good question. I was asked this question in an interview.

Q). What's the easiest and fastest way to move data of a table from file1 to file2?

A). Move the clustered index from file1 to file2.

Why would that be faster than say, creating a target table on file2 and inserting all into it from the source table?


I suppose part of the question was easiest and fastest...

Otherwise nice questions after all.

What you don't know won't hurt you but what you know will make you plan to know better
Pam Brisjar
Pam Brisjar
SSC Eights!
SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)

Group: General Forum Members
Points: 910 Visits: 2804
I knew this one because I've been "bit" by it before. Would indeed be better if there was a warning.

And for the why not create another table and move the data into that, there's DDL issues and possibly space issues, too. It's also many more steps.
TomThomson
TomThomson
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10712 Visits: 12016
Ouch -you got me - I didn't notice "clustered".

And I've complained about people not reading questions carefullyBlush!

Tom

rchantler
rchantler
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 554
Got this one wrong. I figured since there was a contradiction in the statement, SQL should complain. Why does it choose FG1 over FG2? Seems arbitrary to me.
David Todd-242471
David Todd-242471
Say Hey Kid
Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)

Group: General Forum Members
Points: 691 Visits: 410
Hi,

I accept that others have tested and found that everything is created on FG1.

>> from SQL 2008 BOL
If CLUSTERED is specified or the constraint otherwise creates a clustered index, and a <partition_scheme> is specified that differs from the <partition_scheme> or filegroup of the table definition, or vice-versa, only the constraint definition will be honored, and the other will be ignored.
<<

I read that and figured that both would be created on FG2, that is, the filegroup specification on the clustered indexed is ignored.

But looking at it again, it could be read either way ...

Cheers
David
bhushanvinay
bhushanvinay
Old Hand
Old Hand (329 reputation)Old Hand (329 reputation)Old Hand (329 reputation)Old Hand (329 reputation)Old Hand (329 reputation)Old Hand (329 reputation)Old Hand (329 reputation)Old Hand (329 reputation)

Group: General Forum Members
Points: 329 Visits: 196
Any DBCC PAGE output on this.

Regards
Vinay
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search