Hi,
I have to perform a delete on a table. About 73.000
records that actually need 2.5 GB of storage. I simply
will perform a delete from table where .... Should i
consider doing this after hours ? What impact should i
consider for this action ' this is a 24x7 DB Server.
I'm planning the delete and after do a dbcc clean table to
organize the table and index.
Any suggestions or recommendations '
Thanks in advance
MikePresonally I would set up a job to
1. Backup the database
2. Delete the data
3. CLEANDB
4. DBREINDEX
5. ShrinkFile
The major inpact will be on any batch jobs happening on
that table at the same time i.e it may not be using it but
it may be linked to the process, which could cause locking.
J
>--Original Message--
>Hi,
>I have to perform a delete on a table. About 73.000
>records that actually need 2.5 GB of storage. I simply
>will perform a delete from table where .... Should i
>consider doing this after hours ? What impact should i
>consider for this action ' this is a 24x7 DB Server.
>I'm planning the delete and after do a dbcc clean table
to
>organize the table and index.
>Any suggestions or recommendations '
>Thanks in advance
>Mike
>.
>|||I agree with Julie on some points but not all. Always backup the db first.
I would do the deletes in smaller batches and you might need to backup the
tran log in between. If the rows take up 2.5GB of space then you will have
at least that much in the tran log. DBCC CLEANTABLE may not buy you
anything here since you aren't dropping any columns. I would do a DBREINDEX
but DO NOT issue a Shrinkfile unless you absolutely need that space. A
Shrinkfile will most likely undo all you just accomplished with the
DBREINDEX.
--
Andrew J. Kelly
SQL Server MVP
"Julie" <anonymous@.discussions.microsoft.com> wrote in message
news:12c0d01c4433e$ffa93890$a301280a@.phx.gbl...
> Presonally I would set up a job to
> 1. Backup the database
> 2. Delete the data
> 3. CLEANDB
> 4. DBREINDEX
> 5. ShrinkFile
> The major inpact will be on any batch jobs happening on
> that table at the same time i.e it may not be using it but
> it may be linked to the process, which could cause locking.
> J
>
> >--Original Message--
> >Hi,
> >
> >I have to perform a delete on a table. About 73.000
> >records that actually need 2.5 GB of storage. I simply
> >will perform a delete from table where .... Should i
> >consider doing this after hours ? What impact should i
> >consider for this action ' this is a 24x7 DB Server.
> >
> >I'm planning the delete and after do a dbcc clean table
> to
> >organize the table and index.
> >
> >Any suggestions or recommendations '
> >
> >Thanks in advance
> >Mike
> >.
> >|||i'd recommend deleting the data in small portions instead of one delete
statement that deletes all 73k rows at once. deleting small groups of
data should have minimal to no impact on your users. if you're using
full or bulk-logged recovery, be sure to do transaction log backups at
appropriate times during your deletes.
Mike wrote:
> Hi,
> I have to perform a delete on a table. About 73.000
> records that actually need 2.5 GB of storage. I simply
> will perform a delete from table where .... Should i
> consider doing this after hours ? What impact should i
> consider for this action ' this is a 24x7 DB Server.
> I'm planning the delete and after do a dbcc clean table to
> organize the table and index.
> Any suggestions or recommendations '
> Thanks in advance
> Mike|||Agreed, you only need to do the shrink file if want to
want to get your disk space back.
Totally agree with cleantable.
Deletion not too sure I agree, personally prefer to get
it al over at once.
Shrinkfile affecting DBREINDEX, i didn't know that
thanks, but wouldn't it just squeeze the pages together
rather than changing the order ?
J
>--Original Message--
>I agree with Julie on some points but not all. Always
backup the db first.
>I would do the deletes in smaller batches and you might
need to backup the
>tran log in between. If the rows take up 2.5GB of space
then you will have
>at least that much in the tran log. DBCC CLEANTABLE may
not buy you
>anything here since you aren't dropping any columns. I
would do a DBREINDEX
>but DO NOT issue a Shrinkfile unless you absolutely need
that space. A
>Shrinkfile will most likely undo all you just
accomplished with the
>DBREINDEX.
>--
>Andrew J. Kelly
>SQL Server MVP
>
>"Julie" <anonymous@.discussions.microsoft.com> wrote in
message
>news:12c0d01c4433e$ffa93890$a301280a@.phx.gbl...
>> Presonally I would set up a job to
>> 1. Backup the database
>> 2. Delete the data
>> 3. CLEANDB
>> 4. DBREINDEX
>> 5. ShrinkFile
>> The major inpact will be on any batch jobs happening on
>> that table at the same time i.e it may not be using it
but
>> it may be linked to the process, which could cause
locking.
>> J
>>
>> >--Original Message--
>> >Hi,
>> >
>> >I have to perform a delete on a table. About 73.000
>> >records that actually need 2.5 GB of storage. I simply
>> >will perform a delete from table where .... Should i
>> >consider doing this after hours ? What impact should i
>> >consider for this action ' this is a 24x7 DB Server.
>> >
>> >I'm planning the delete and after do a dbcc clean
table
>> to
>> >organize the table and index.
>> >
>> >Any suggestions or recommendations '
>> >
>> >Thanks in advance
>> >Mike
>> >.
>> >
>
>.
>|||Not sure if this applies, but if you are deleting all the records in the
table you can use the TRUNCATE command.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Julie wrote:
> Shrinkfile affecting DBREINDEX, i didn't know that
> thanks, but wouldn't it just squeeze the pages together
> rather than changing the order ?
it changes the page order dramatically. in fact, it's sort of a goofy
situation. you shrink the db to get all the data to the front of the
file. after you shrink it, it's most likely very heavily fragmented.
so then you defrag it. when you defrag it, it moves pages out into the
free space in the db file(s), so now your pages are no longer all at the
front of the file.|||Thanks ch,
I never knew that.
J
>--Original Message--
>Julie wrote:
>> Shrinkfile affecting DBREINDEX, i didn't know that
>> thanks, but wouldn't it just squeeze the pages together
>> rather than changing the order ?
>it changes the page order dramatically. in fact, it's
sort of a goofy
>situation. you shrink the db to get all the data to the
front of the
>file. after you shrink it, it's most likely very
heavily fragmented.
>so then you defrag it. when you defrag it, it moves
pages out into the
>free space in the db file(s), so now your pages are no
longer all at the
>front of the file.
>.
>|||Hi,
Thanks for your comments, but now i have a problem:
1. I backed up the database
2. i've made the delete in small batches
3. This table only has a clustered index on an PK Column,
i have performed a DBREINDEX on that Pk clustered index.
Results:
name
C29___BINARIES
rows reserved data index_size unused
221392 4902000 KB 2724296 KB 112 KB 2177592 KB
How can i free the unused table space '? Why the
dbreindex didin't release this space '
Sorry :) Can you help me ?
Thanks again
Mike|||dbcc updateusage (0) with count_rows
it may actually be freed but not recorded yet.
Mike wrote:
> Hi,
> Thanks for your comments, but now i have a problem:
> 1. I backed up the database
> 2. i've made the delete in small batches
> 3. This table only has a clustered index on an PK Column,
> i have performed a DBREINDEX on that Pk clustered index.
> Results:
> name
> C29___BINARIES
> rows reserved data index_size unused
> 221392 4902000 KB 2724296 KB 112 KB 2177592 KB
> How can i free the unused table space '? Why the
> dbreindex didin't release this space '
> Sorry :) Can you help me ?
> Thanks again
> Mike
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment