Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8419743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:41:47+00:00 2026-06-10T02:41:47+00:00

Consider a table invoice_data containing data about invoices over 12 years. This data will

  • 0

Consider a table invoice_data containing data about invoices over 12 years. This data will be loaded into a cube every day. With every load, the newest 2 years get deleted from invoice_data and the data of the last 2 years gets imported by the live system again. (We do that, because values may change in older data sets, too)

This delete statement takes about 15 minutes, but we can’t use a truncate, because we would have to load the whole 12 years which will take much longer.

Question:

Is it a good design to split a large table invoice_dat like this

  • invoice_data_old, which contains years < actual year - 2
  • invoice_data_new, which contains years >= actual year -2

This way, we could use a truncate on invoice_data_new and there is no need to use a delete statement?

Are there any better approaches?

I am using SQL SERVER 2008, but i think this is a general question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:41:48+00:00Added an answer on June 10, 2026 at 2:41 am

    I think that the best approach to this problem is ‘horizontal partioning’. Basically, you create a sliding window of data – as a new period of data is added at the end, the old data is removed at the beginning.

    Over the course of 4 years, you might have 48 partitions (one per month).

    The big advantage with this approach is that SQL server is aware that the data is partioned in this way, and can automatically optimise queries to only use partitions that have relevant data – i.e. when you select data from the last month, SQL Server will know to only search one partition, or 1/48th of the data.

    Another important aspect is that removing the oldest partition becomes a metadata operation, so does not lock anything.

    The downside of this approach is that it does take more effort in terms of setting up and maintaining (unless you write some automated month-end scripts, which may be a non-trivial exercise)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this table structure people{id,firstName,lastName,preferredName} list{id,person1_id,person2_id} I want to get all data from list
Consider this table on SQL Server wordID aliasID value =========================== 0 0 'cat' 1
Consider a table or CTE structured like this: Name Num ---- ---- Abc 12
please consider this table: PK_Id Number Year Month Value ------------------------------------------------------------------------- 1 1 2000 5
I am trying to accomplish this: Consider a table view with Search Bar on
Consider this table: c_const code | nvalue -------------- 1 | 10000 2 | 20000
Consider this table (from http://www.tizag.com/mysqlTutorial/mysqlmax.php ): Id name type price 123451 Park's Great Hits
Consider a table datatbl like this: +----------+ | strfield | +----------+ | abcde |
Consider a table like this: | Name | Version | Other | | ---------------------|-------|
Consider create table pairs ( number a, number b ) Where the data is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.