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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:49:02+00:00 2026-06-13T05:49:02+00:00

I have two tables members and dep whose description are as follows: TABLE members:

  • 0

I have two tables members and dep whose description are as follows:

TABLE members:
+-----------------+------------+------+-----+---------+-------+
| Field           | Type       | Null | Key | Default | Extra |
+-----------------+------------+------+-----+---------+-------+
| MemberID_M      | varchar(8) | YES  | MUL | NULL    |       |
| Age             | varchar(5) | YES  |     | NULL    |       |
| Sex             | varchar(1) | YES  |     | NULL    |       |
| SomeInfo        | int(11)    | YES  |     | NULL    |       |
+-----------------+------------+------+-----+---------+-------+
TABLE dep:
+-----------------+------------+------+-----+---------+-------+
| Field           | Type       | Null | Key | Default | Extra |
+-----------------+------------+------+-----+---------+-------+
| MemberID_t      | int(11)    | YES  | MUL | NULL    |       |
| YEAR            | varchar(2) | NO   |     |         |       |
| Days            | tinyint(4) | YES  |     | NULL    |       |
| train           | bigint(20) | NO   |     | 0       |       |
+-----------------+------------+------+-----+---------+-------+

I want to perform the following query:

CREATE TABLE table2 
SELECT a.*,b.* 
FROM dep AS a LEFT OUTER JOIN members AS b 
          ON  a.MemberID_t = b.Memberid_M;

Intially, the ids in both the tables were not indexed and the query did not return for hours. Now, even after indexing it is taking a lot of time.

EXPLAIN for the SELECT part of the query is:
+----+-------------+-------+------+---------------+------+---------+------+--------+-------+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows   | Extra |
+----+-------------+-------+------+---------------+------+---------+------+--------+-------+
|  1 | SIMPLE      | a     | ALL  | NULL          | NULL | NULL    | NULL | 436689 |       |
|  1 | SIMPLE      | b     | ALL  | memid2        | NULL | NULL    | NULL | 226127 |       |
+----+-------------+-------+------+---------------+------+---------+------+--------+-------+
  • 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-13T05:49:03+00:00Added an answer on June 13, 2026 at 5:49 am

    The problem is MemberID_M is a varchar and MemberID_t is an INT

    The conversion of this fields is why take so long

    For optimal results, the key fields has to be the same type

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

Sidebar

Related Questions

I have data from two tables in a members system as follows: Table: listuser
I have two parent tables, BusinessGroup and SocialGroup, and one child table, Members. A
I have two tables: members ( userid int primary key ) login_history ( userid
I have two tables: members and renewals The two tables have a field called
Complete noob question, so apologies for that. I have two tables, a members table
I have two tables, in a many-to-many relationship, with a junction table, as follows:
I have the following two table: -Groups- Id Name -Members- Id GroupId (Group.Id is
I have two tables: table a ida valuea 1 a 2 b 3 c
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables users registered_members I want to confirm values from user table

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.