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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:46:57+00:00 2026-05-26T07:46:57+00:00

I have an MEMORY MYSQL database that contains a table with 200k+ rows. I

  • 0

I have an MEMORY MYSQL database that contains a table with 200k+ rows. I use this database to test trading strategies, so it is queried repeatedly ad nauseum. No new data is added to the database.

One column in this database’s primary table is “Time of day”. At each query my stored procedure selects those rows where the “Time of day” falls a maximum of 2 hours before or 2 hours after the query input “Time of day”.

Since the data in my database has a 5-minute resolution, there are total of 288 possible “Times of day” (24 * 60/5 = 288).

This means that each query selects roughly 1/288 of the table.
Furthermore, that means that there is a huge overlap between query A and query B (which immediately follows).

At this moment, there is simply 1 huge table which gets filtered at each query. This is (way too) slow.

I have been trying to figure out a more optimal setup. I have considered creating 288 pre-filtered tables and simply access them at query time. That, however, takes too much RAM and ends up slowing the query instead of speeding it up.

Are there any more optimal solutions?

  • 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-26T07:46:58+00:00Added an answer on May 26, 2026 at 7:46 am

    You could simply add an integer column to the table to indicate which “window” the transaction is in. So the field would hold a value between 1 and 288 for each record which would need to be updated in a one-time update.

    After that querying the table would simply be:

    select * from mytable where window = 123
    

    for example. It is essential to add an index to this column.

    Having said this, I’d be surprised if this performs much better than just querying against the date column (assuming that is already indexed of course) but might be worth a try.

    Filtering a 200k row table with an index on a single field really should be very quick. Have you verified that the delay is caused by the database engine and not the retrieval of the results?

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

Sidebar

Related Questions

I have a Symfony application which use a mysql database to store session data,
I have some data in MySQL database that are static most of the time.
I have a small mySQL database and a few simple php based webpages that
I have a mysql database table filled with 1000+ records, lets say 5000 records.
I have a MySQL database-table with the following colums ID status (can contain values
Ignoring unsafe code, .NET cannot have memory leaks. I've read this endlessly from many
I have a memory buffer corresponding to my screen resolution (1280x800 at 24-bits-per-pixel) that
I have a memory block that is divided into a series of location that
I have vague memory of a screenshot of a VS plugin that colors different
I have an interesting database problem. I have a DB that is 150GB in

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.