Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
Administering
»
data archiving
16 posts, Page 2 of 2
««
1
2
data archiving
Rate Topic
Display Mode
Topic Options
Author
Message
gan-685682
gan-685682
Posted Tuesday, August 26, 2008 11:26 PM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 2:03 AM
Points: 79,
Visits: 211
that mean I need to go thru' trial-and-error? Thanks anyway
Post #559339
Jeff Moden
Jeff Moden
Posted Wednesday, August 27, 2008 6:35 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
Heh... no... trust me... I just got done reducing/archiving a 131 million row table to a 44 million row table using the 20k method I spoke of... on a 24/7 system. ;) I don't make recommendations unless I've actually done them (and the related trial and error).
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #560047
gan-685682
gan-685682
Posted Wednesday, August 27, 2008 10:42 PM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 2:03 AM
Points: 79,
Visits: 211
Great, you looks confident! how you do partitioning switching? dynamic queries? manual? how often? weekly? monthly?
using the 20k method? what 20k method?
Post #560114
Jeff Moden
Jeff Moden
Posted Thursday, August 28, 2008 6:57 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
Depends on what your partitions are based on. Mine are based on a "CampaignID"... any campaign that hasn't had a new row added to it in 90 days gets archived. I just do a select/group by on the CampaignID and the Max LoadDate vs GETDATE() and loop through the campaigns to do the Insert/Delete's. It's actually a double loop... inside loop does the archival insert/delete 20K rows at a time as previously determined by divided the number of rows present for that campaign by 20k.
I can't use a partitioned view to do it because I need to log which underlying table the campaign was in for possible restore processes. As you suggest, a bit of dynamic SQL takes care of all that.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #560929
Jeff Moden
Jeff Moden
Posted Thursday, August 28, 2008 7:02 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
Almost forgot... at my previous job, the archive process ran nightly. At my current job, it runs on Monday and Thursday nights. First run may take a day or more to complete, but it's online all the time. After that, the daily jobs (same as the first job) are a piece of cake and may only take a couple of seconds to execute depending, of course, how many rows slip past your cutoff date on any given day.
Some folks have suggested that such a thing be built into a trigger... past experience tells me that will eventually turn out to be a source of deadlocks on high volume systems.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #560931
gan-685682
gan-685682
Posted Thursday, August 28, 2008 10:44 PM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 2:03 AM
Points: 79,
Visits: 211
thanks for your explaination. :D
Post #560989
« Prev Topic
|
Next Topic »
16 posts, Page 2 of 2
««
1
2
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.