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 6659391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:01:45+00:00 2026-05-26T02:01:45+00:00

I am working on time series data, for which the key column is a

  • 0

I am working on time series data, for which the key column is a timestamp : Time.
There are also many “value” columns for each row.

I am about to shift a whole range of my data by several hours (due to a daylight saving time issue).
For that, I will update the key of several rows, and it might result in some duplicate keys. I would like the duplicate keys on the edge of the date range to be ignore. I want the shifted range to override the old one.

I plan to do something like :

UPDATE IGNORE time_series_table 
SET time=time-<some_shift> 
WHERE <time in a date-range>

Here is the output of describe <table> for the time key :

Field     Type      Null Key     Default Extra
TimeMeas  datetime  NO   PRI     NULL

My question is : Will it shift all the keys at once, or will it try to shift each row one by one, resulting in massive duplicate keys wihthin the shifted range itself ?

Do you have a better way of doing this in mind ?
Thanks in advance

  • 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-05-26T02:01:45+00:00Added an answer on May 26, 2026 at 2:01 am

    Will it shift all the keys at once, or will it try to shift each row one by one

    It will shift all the keys at once.

    resulting in massive duplicate keys wihthin the shifted range itself ?

    It just failed if any of primary key is duplicated.
    With update ignore, it just skip silently.

    This is my approach to fix this

    /* create a temporary table to store matches records*/
    create table tmp_table select time-<some_shift>, etc_cols....
    from time_series_table 
    where <time in a date-range>;
    

    then

    /* delete the matches in the original table */
    delete from time_series_table where <time in a date-range>;
    delete from time_series_table where <time in a date-range - some_shift>;
    

    finally

    /* at this point, there won't be any duplicate data */
    /* so, insert back into original table */
    insert into time_series_table select * from tmp_table;
    optmize table time_series_table;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with very long time series -- hundreds of millions of data points
I am working on a site in which there are a series of elements,
I am working with data, 1st two columns are dates, 3rd column is symbol,
I am working on a time series based calculation. Each iteration of the calculation
Hye Guys, I'm busy working on a time series and am trying to find
From my time working with Ruby On rails, there is a couple different packaged/projects
I have a (C#) genetic program that uses financial time-series data and it's currently
I'm working with an api that sends data in a series of base64 strings
There exists a Hibernate entity WeatherStatistic which contains snapshots of atmospheric data at given
I'm having a time series data sets comprising of 10 Hz data over several

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.