Re: Alter Table for 39 million rows
From: David Gugick (davidg-nospam_at_imceda.com)
Date: 12/22/04
- Next message: David Gugick: "Re: how to 'join' two tables during insert, without using a cursor?"
- Previous message: Will: "Re: How to detect SQL server edition"
- In reply to: Adam Machanic: "Re: Alter Table for 39 million rows"
- Next in thread: Mark Wilden: "Re: Alter Table for 39 million rows"
- Reply: Mark Wilden: "Re: Alter Table for 39 million rows"
- Reply: Adam Machanic: "Re: Alter Table for 39 million rows"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 21 Dec 2004 19:58:54 -0500
Adam Machanic wrote:
> "Kalen Delaney" <replies@public_newsgroups.com> wrote in message
> news:OxfYzl65EHA.3708@TK2MSFTNGP14.phx.gbl...
>>
>> I have done a lot of testing on this, but I haven't tested every
>> single possible scenario. Sometimes SQL Server will change all the
>> rows during the ALTER TABLE, and sometimes it won't.
>
>
> Can you show me one where it won't? I just tested a few, and it
> seemed to change the row size during the ALTER every single time.
>
> Thanks!
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
I did a bunch of tests as well:
NO TABLE GROWTH
- Adding a new varchar() column to the table seems to make no difference
and ran fast
- Changing a varchar(20) to a varchar(40) didn't make a difference and
ran fast
- Changing from datetime to smalldatetime made no difference and ran
fast
- Changing from a char(20) to a char(10) made no difference and ran fast
as long as the data won't get truncated
TABLE GROWTH
- Moving from a fixed character type char(20) to char(40) forced the
table to grow
- Moving from a char(20) to a varchar(40) forced the table to grow
- Moving from a varchar(20) to a char(20) caused growth and was slow (in
the test I did).
- Moving from smalldatetime to datetime caused growth and was slow as
well. Even using NULLs for all values in the datetime test caused
growth.
- Changing from INT to BIGINT caused the table to grow
-- David Gugick Imceda Software www.imceda.com
- Next message: David Gugick: "Re: how to 'join' two tables during insert, without using a cursor?"
- Previous message: Will: "Re: How to detect SQL server edition"
- In reply to: Adam Machanic: "Re: Alter Table for 39 million rows"
- Next in thread: Mark Wilden: "Re: Alter Table for 39 million rows"
- Reply: Mark Wilden: "Re: Alter Table for 39 million rows"
- Reply: Adam Machanic: "Re: Alter Table for 39 million rows"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|