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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:42:14+00:00 2026-06-04T01:42:14+00:00

I have two tables. Each one is populated with about 50K records. Both have

  • 0

I have two tables. Each one is populated with about 50K records. Both have one common field. I want the records of both tables where the common field is matching. So I use the following SQL code. The problem is that the query is running now for already 20 minutes and nothing happening. It seems strange to me that it is taking so much time. I wonder if there is a better way to achieve my target. Thank you in advance for your replies.

My SQL code:

Select * from tableOne T1, tableTwo T2 
Where T1.name = T2.name

By the way I am open to php solutions (loops or whatever if it is better…)

  • 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-04T01:42:15+00:00Added an answer on June 4, 2026 at 1:42 am

    Two things:

    1. You need to make sure there is an index on the name column in both tables. Otherwise the query will have to essentially scan every row of each table looking for matches.

    2. Ideally, the index should have “included columns” that you want to select in the query. Otherwise the query won’t be able to fully use the index, but will have to go back to the table and pick up the other columns manually for each row. This means you should consider selecting only the columns you need (rather than *) in the query, and adding those columns as included columns to the index.

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

Sidebar

Related Questions

I have a problem with mutual constraints. I want to have two tables each
I have two tables, each one has a primary ID column as key. I
I've got a bunch of strongly typed DataSet that each have two tables. One
Suppose I have two tables A and B and each one has only 1
I have two database tables, one in MYSQL and one in MSSQL. Both have
I have a two tables. One table is actually populated by daily events while
In Oracle I have two tables. Both are populated with data and have a
Hi I want to have two tables each have an INT id column which
I have two tables table1 and table2 each having a column named email along
i have two tables products and reviews each product has several reviews linked by

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.