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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:11:45+00:00 2026-05-24T09:11:45+00:00

I am currently trying to process a large block of simulation data (~2Gb worth).

  • 0

I am currently trying to process a large block of simulation data (~2Gb worth). The data is in a table which looks like:

Table: Simulation Data
+-------+--------+----------+-------+
|   id  | run_id | timestep | value |
+-------+--------+----------+-------+
|     1 |   1    |     1    | 0.00  |
|     2 |   1    |     2    | 0.003 |
|     : |   :    |     :    |   :   |
|  9543 |   1    |  9543    | 0.23  |
|  9544 |   2    |     1    | 0.00  |
|     : |   :    |     :    |   :   |
+-------+--------+----------+-------+

So for each run (identified by a run_id) there are a number of time steps with corresponding data (in the case of run_id 1, there were 9543 time steps).

Durring a simulation run, there are events which take place. These event time steps are recorded in another table:

Table: Simulation Events
+-------+--------+----------+
|   id  | run_id | timestep |
+-------+--------+----------+
|    1  |   1    |  152     |
|    2  |   1    |  193     |
|    3  |   1    |  382     |
|    :  |   :    |   :      |
|  143  |   1    |  9382    |
|  144  |   2    |  137     |
|    :  |   :    |   :      |
+-------+--------+----------+

So for this set of data, with run_id 1, there were events at time step 152, 193, 382, … 9382. run_id 2 has its first event at time step 137, etc. I am interested in what happens in the 3-timesteps before, the time step of, and the 3-timesteps after each event for each run_id. I would like to put together a query that returns something that looks like:

+--------+----------------+----------+-------+
| run_id | event_timestep | delta_ts | value |
+--------+----------------+----------+-------+
|    1   |      152       |   -3     | 0.053 |
|    1   |      152       |   -2     | 0.042 |
|    1   |      152       |   -1     | 0.031 |
|    1   |      152       |    0     | 0.003 |
|    1   |      152       |    1     | 0.532 |
|    1   |      152       |    2     | 0.736 |
|    1   |      152       |    3     | 1.138 |
|    1   |      193       |   -3     | 0.049 |
|    :   |       :        |    :     |   :   |
|    1   |     9382       |   -3     | 0.068 |
|    :   |       :        |    :     |   :   |
|    1   |     9382       |    3     | 1.523 |
+--------+----------------+----------+-------+

Where the first row, with delta_ts = -3 would be the value from timestep 149, -2 would be from timestep 150, -1 from timestep 151, etc. Any thoughts on putting together a query that would do this?

  • 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-24T09:11:46+00:00Added an answer on May 24, 2026 at 9:11 am

    There’s two differing points of view on this:

    • You can use blank joins (cartesian products) select ... from table t1, table t2 where ..., but you have to figure out a condition that links two rows if and only if they’re “related”. Also keep in mind that pairs are commutative in your example, so add a condition like t1.id<t2.id — also excludes self-joins.
    • or you can use a cursor in a stored procedure, and store values for the previous n steps, and correlate them manually. This is slower, uses more memory, but it’s easier to write.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have a large import process that I'm trying to wrap inside a
I have the following code, in which I’m trying to process a large amount
Currently trying to figure out how best to process the following sample XML data:
I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently
I'm currently trying out db4o (the java version) and I pretty much like what
I'm currently trying to optimize the sluggish process of retrieving a page of log
I'm trying to read in a large (700GB) file and incrementally process it, but
I'm trying to optimize the process of inserting a large number of results to
I'm currently trying to determine the name of a parent process that launched a
I'm currently trying to send a post to a php script, which seems to

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.