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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:22:53+00:00 2026-05-18T09:22:53+00:00

I have a query I turned into a view that works OK. But the

  • 0

I have a query I turned into a view that works OK. But the site_phrase sp table seems to be not using a column and goes through all the records in the table. Why is that? Here is the query:

    EXPLAIN SELECT
             `p`.`id`            AS `id`,
             `p`.`text`          AS `phrase`,
             `p`.`ignored`       AS `ignored_phrase`,
             `p`.`client_id`     AS `client_id`,
             `s`.`id`            AS `site_id`,
             `s`.`sub_domain`    AS `sub_domain`,
             `s`.`competitor`    AS `competitor`,
             `s`.`ignored`       AS `ignored_site`,
             `pc`.`id`           AS `pc_id`,
             `pc`.`name`         AS `pc_name`,
             `psc`.`id`          AS `psc_id`,
             `psc`.`name`        AS `psc_name`,
             `p`.`volume`         AS `volume`,
             MIN(`pos`.`position`) AS `position`,
             `pos`.`id`         AS `pos_id`
  FROM `client` c 
  JOIN client_site cs ON cs.client_id = c.id
  JOIN site s ON s.id = cs.site_id
  JOIN site_phrase sp ON sp.site_id = s.id
  JOIN phrase p ON p.id = sp.phrase_id
  JOIN `position` pos ON pos.phrase_id = sp.phrase_id
    AND pos.site_id = sp.site_id
  LEFT JOIN `phrase_sub_category` `psc`
    ON `psc`.`id` = `p`.`phrase_sub_category_id`
  LEFT JOIN `phrase_category` `pc`
    ON `pc`.`id` = `psc`.`phrase_category_id`
  GROUP BY `p`.`id`,`s`.`id`,`serp`.`id`
  ORDER BY `p`.`id`,`pos`.`position`

And here is a screenshot of the output the above query gets when I EXPLAIN / DESCRIBE it
http://img827.imageshack.us/img827/3336/indexsql.png

No matter how I alter the order of the tables above and how they are joined, the 1st or 2nd table always seems to be doing some sort of table scan. In the example of the screenshot, the problem table is sp. These tables are innoDB type, and there is appropriate indexes and foreign keys on all the tables I JOIN on. Any insights would be helpful.

  • 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-18T09:22:54+00:00Added an answer on May 18, 2026 at 9:22 am

    MySQL will use a full table scan if it determines that it is faster than a using index. In the case of your SP table – with only 1300 records the table scan may be just as fast as a index.

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

Sidebar

Related Questions

I am using in C# MYsql .I have query that works if I run
I have query to show the table like this: but I want to PIVOT
I have a query that successfully grabs the unique products from my products table
I have an EF Code First Db context that I'm using to query the
I have query table copyQuery which has Soil Condition has one of the columns,
I have a query in Access 2007. It's worked fine for months, but I'm
I have a JTable that stores the results of a database query, so far
I have a big fat query that's written dynamically to integrate some data. Basically
OK. I have turned off AutoDetectChangesEnabled, and when I query the context, modify an
I have a VB6 application that works fine on most Windows 7 machines (even

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.