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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:18:00+00:00 2026-06-12T19:18:00+00:00

I have a table with 15,000,000 records. These records can be related to one-another

  • 0

I have a table with 15,000,000 records. These records can be related to one-another based on certain matching fields (typically a max of 3 or 4 in a single group). Each record also has a date associated with it, however this date does not necessarily correlate to the date/order it was loaded into the table.

These records are periodically used to updated other records in the database. I only care about the LATEST record in a single group, though, and at 15 million records (which are updating another 10 million records), I want to make sure that I ignore everything else. I also want to skip an update if the latest record already has an “updated” flag.

I’ve been using the a view like this to collect the latest record within each group:

SELECT a, b, c, max(scan.timestamp) AS latest_scan
FROM scan
GROUP BY a, b, c;

I then use a WHERE clause in my UPDATE to ignore any records with the updated flag.

With this many records, am I okay using a view? I’ve seen people start creating real indexible tables on the fly in order to increase performance, but I still feel like that would take ages. Is this something that I could benefit from?

  • 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-12T19:18:01+00:00Added an answer on June 12, 2026 at 7:18 pm

    Mostly you need to try it and see what the performance is like.

    The key thing is that the view will end up being a quick notation of a sub-query which will give the optimizer information. So, it’s still going to mostly depend on whether the optimizer can find indexes to use for the SQL statements you call the database with.

    Notice that you probably don’t need the ORDER BY in your view, since you will be using it in some other SQL statement, which can then order the records. If the optimizer doesn’t figure out that it can skip the order by, then you’re just going to spend time sorting when you won’t need to.

    I would expect you could use a GROUP BY a, b, c to get the max timestamp for the group.

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

Sidebar

Related Questions

I have two large tables in MySQL, one containing about 6,00,000 records and another
I have a table with just 3,000 records. I render these 3000 records in
I have a two tables cstomers and orders table. These tables contain 20,000 records
I have a SQL Server database with 500,000 records in table main . There
I have table with 300 000 records (MyISAM). I get record from this table
i have a table with about 200,000 records. i want to add a field
I have a users table with 450,000 records. The table structure is as so:
I have quite a large table with 19 000 000 records, and I have
I have some 30,000 records in my Raw_deals table and some raw_cities table has
Hope all is well. I have a table with about 491,000 unique records 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.