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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:53:44+00:00 2026-05-13T17:53:44+00:00

Im getting very confused with indexes in MySQL. I have two tables: TableA1 and

  • 0

Im getting very confused with indexes in MySQL.

I have two tables: TableA1 and TableA2.

I created indexes on these for the joins between them and queries run really fast.

I have another 2 tables with an identical setup e.g. TableB1 and TableB2. The only difference is that these tables have a few null values.

For some reason the same query on TableA is about 5 times faster and doesn’t require a full-table scan. TableB however seems to use a full table scan and I can’t work out why. Could it be the Null values that are causing this?

I notice using EXPLAIN that on the TableA setup, I get possible keys: myindex and also ref: func; however on the TableB setup I get just possible keys: NULL and ref: NULL.

I have searched around for quite a while on this, and cannot seem to find a relevant answer. Would appreciate if someone can point me in the right direction.

(Sorry, now added to the original question.)

Here is TableAOne:

CREATE TABLE `TableAOne` (
  `field1` varchar(255) DEFAULT NULL,
  `field2` varchar(255) DEFAULT NULL,
  KEY `myindex` (`field1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

And TableATwo:

CREATE TABLE `TableATwo` (
  `Field3` varchar(255) ,
  `Field4` varchar(255) ,
  `Field5` varchar(255) ,
  `id` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15522 DEFAULT CHARSET=utf8;

I am joining Field3 with Field1.

The tables that get the full-table scan are identical to the above tables. The only difference is they are called TableB instead of TableA.

Cheers,
Ke

  • 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-13T17:53:45+00:00Added an answer on May 13, 2026 at 5:53 pm

    I just deleted the table and re-installed it to the db (i did change utf8 to latin1 not sure if this made a difference),however it works now, really strange! thanks v much for all the replies they certainly pushed me towards the answer cheers 🙂

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

Sidebar

Related Questions

I am getting very confused in some concepts in c++. For ex: I have
Simple, very straight forward but seems uncle google and me getting confused. I have
I am learning PDO and i am getting very confused, I have this piece
I have just started getting a very strange error when using jQueryMobile for my
I'm getting very confused about how audio devices/lines/endpoints are named in windows (vista). First
I'm a newbie at VBA and html and I'm getting very confused. I'm trying
I'm getting very confused with memory management in relation to vectors and could do
I'm getting very confused here, though i'm very new to the HTML 5 canvas.
Getting very confused with echoing an HTML anchor with a variable inside. <?php echo
I'm working on my first C++/CLI wrapper and am getting very confused wrt pointers.

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.