SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


File Groups


File Groups

Author
Message
Toby White
Toby White
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1531 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
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1550 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
Hall of Fame
Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)

Group: General Forum Members
Points: 3000 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.
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

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

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

Tom

rchantler
rchantler
SSC-Addicted
SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)SSC-Addicted (435 reputation)

Group: General Forum Members
Points: 435 Visits: 611
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
SSChasing Mays
SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)SSChasing Mays (621 reputation)

Group: General Forum Members
Points: 621 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