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

  • SEARCH
  • Home
  • 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 7944311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:30:55+00:00 2026-06-04T00:30:55+00:00

I have a table with few million records. ___________________________________________________________ | col1 | col2 |

  • 0

I have a table with few million records.

___________________________________________________________
| col1 | col2 | col3 | some_indicator | last_updated_date |
-----------------------------------------------------------
|      |      |      |        yes     | 2009-06-09.12.2345|        
-----------------------------------------------------------
|      |      |      |        yes     | 2009-07-09.11.6145|
-----------------------------------------------------------
|      |      |      |        no      | 2009-06-09.12.2345|
-----------------------------------------------------------

I have to delete records which are older than month with some_indicator=no.
Again I have to delete records older than year with some_indicator=yes.This job will run everyday.

Can I use db2 partitioning feature for above requirement?.
How can I partition table using last_updated_date column and above two some_indicator values?
one partition should contain records falling under monthly delete criterion whereas other should contain yearly delete criterion records.
Are there any performance issues associated with table partitioning if this table is being frequently read,upserted?
Any other best practices for above requirement will surely help.

  • 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-04T00:30:57+00:00Added an answer on June 4, 2026 at 12:30 am

    I haven’t done much with partitioning (I’ve mostly worked with DB2 on the iSeries), but from what I understand, you don’t generally want to be shuffling things between partitions (ie – making the partition ‘1 month ago’). I’m not even sure if it’s even possible. If it was, you’d have to scan some (potentially large) portion of your table every day, just to move it (select, insert, delete, in a transaction).

    Besides which, partitioning is a DB Admin problem, and it sounds like you just have a DB User problem – namely, deleting ‘old’ records. I’d just do this in a couple of statements:

    DELETE FROM myTable 
    WHERE some_indicator = 'no'
    AND last_updated_date < TIMESTAMP(CURRENT_DATE - 1 MONTH, TIME('00:00:00'))
    

    and

    DELETE FROM myTable
    WHERE some_indicator = 'yes'
    AND last_updated_date < TIMESTAMP(CURRENT_DATE - 1 YEAR, TIME('00:00:00'))
    

    …. and you can pretty much ignore using a transaction, as you want the rows gone.

    (as a side note, using ‘yes’ and ‘no’ for indicators is terrible. If you’re not on a version that has a logical (boolean) type, store character ‘0’ (false) and ‘1’ (true))

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

Sidebar

Related Questions

I have a table with a few million records in it. I want to
I already have 80 million records inserted into a table, but need to ensure
I have a table with a few million tuples. I perform updates in most
I'm using SQL Server 2008. I have a table with over 3 million records,
I have an innodb table that contains 70 million records and already has several
I have a queryset with a few million records. I need to update a
I have huge table (millions of records) in which a few hundreds to a
I have an ORACLE table with a few million rows of data. One of
I have table with few rows, after use hover mouse over row I want
I have a table with few columns and one of the column is DockNumber.

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.