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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:24:58+00:00 2026-05-27T08:24:58+00:00

I have data split across several mysql tables to prevent data duplication but joining

  • 0

I have data split across several mysql tables to prevent data duplication but joining them is too slow when I actually go to serve the data. I am thus building a much smaller cache table of the data which is likely to be needed in the near future (certain data is only relevant for a small time frame so the whole tables are ~700,000 rows but the cache is ~6,000).
Building this cache uses a temp table before copying into the actual cache table so that while the table is built each night, the live cache table doesn’t go down. Sometimes the cache table gets built in about 30 minutes, but other times it gets stuck and will never complete. In the process list it just says Copying to tmp table but it will spin for days if I let it.

What can I do to prevent getting stuck in Copying to tmp table? I have looked around and nowhere online can I find a very clear answer to what causes this except for some of the info here which I have tried to follow but to no avail.

I would think that there might be a better way for me to build the table rather than address memory concerns since the final table is small in rows (although each row is fairly large). The general form of the build query to make the cache table is

Select col1,col2,col3... FROM tbl1 INNER JOIN tbl2 on ... INNER JOIN tbl3 on ... 
  LEFT JOIN (SELECT col4, col5, col6... FROM tbl4 INNER JOIN tbl5 on ...) 
  AS tbl6 on ... WHERE col2 > NOW() ORDER BY col3, col4

The left join is needed since I want to have copies of the data in the inner select if it exists, but don’t want to limit by it if it doesn’t.
I’m sorry if this isn’t specific enough but if anyone has any idea how to prevent the Copying to tmp table I would greatly appreciate it.

  • 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-27T08:24:59+00:00Added an answer on May 27, 2026 at 8:24 am

    Have you set up indexes on tables? Indexes on columns which you are using in joins will speed up the select query.
    Maybe better solution for you in this case would be materialized view: http://fromdual.com/mysql-materialized-views

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

Sidebar

Related Questions

I am querying tables from Microsoft SQL 2008 which have date split across 3
Which would be faster in retrieving data from a mysql database? Data split across
I have a data april/2010 to jan/2011 Is there any way to split the
I have a SSIS Data Flow Task with an OleDb Source, Conditional Split (w/
When I using the following code to read file: lines=file(data.txt).read().split(\n) I have the following
my data is dat1; the split statement is var splitstr = dat1.split(-); I have
I have data in a MySQL database. I am sending the user a URL
I have data from MySQL showing all organisations a customer got, with all details
My warehouse datamart data is split across 3 databases on the same server. This
In my MS Access application I have several forms that are very data intensive

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.