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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:27:42+00:00 2026-06-15T21:27:42+00:00

I’m running queries on an old mysql database and many queries are taking far

  • 0

I’m running queries on an old mysql database and many queries are taking far longer than they should. for example this one, ad_vehicle has 60000 rows, id_ad_link has 25000

SELECT * FROM autotalk_identicar_old.ad_vehicle 
left join autotalk_identicar_old.id_ad_link on autotalk_identicar_old.ad_vehicle.vehiclekey=autotalk_identicar_old.id_ad_link.rbvehiclekey;

duration is 2.323 seconds, fetch is still going 12 minutes after hitting execute (using mysql workbench, not sure if that makes any difference though). running in a vm with 3 cores of my amd quad core @ 3.4ghz with 1gb memory

I don’t think there are any indexes/primary keys however would that make such a big difference?

first few rows of ad_vehicle

A145 00AA, PV, ALFA, 145, 2000, 3HBm, 1.6, , , , , P, , 5, 1596, , , 32995,  , , 3HBm 1.6p
A145 00AB, PV, ALFA, 145, 2000, 3HBm, 1.7, , , , , P, , 5, 1712, , , 41995,  , , 3HBm 1.7p
A145 01AA, PV, ALFA, 145, 2001, 3HBm, 1.6, , , , , P, , 5, 1596, , , 32995,  , , 3HBm 1.6p
A145 01AB, PV, ALFA, 145, 2001, 3HBm, 1.7, , , , , P, , 5, 1712, , , 41995,  , , 3HBm 1.7p
A145 02AA, PV, ALFA, 145, 2002, 3HBm, 1.6, , , , , P, , 5, 1596, , , 32995,  , , 3HBm 1.6p
A145 02AB, PV, ALFA, 145, 2002, 3HBm, 1.7, , , , , P, , 5, 1712, , , 41995,  , , 3HBm 1.7p
A145 95AA, PV, ALFA, 145, 1995, 3HBm, 1.6, , L, , , P, , 4, 1596, , , 32995,  , , 3HBm 1.6p L
A145 95AB, PV, ALFA, 145, 1995, 3HBm, 1.7, ELEGANTE, L, , , P, , 4, 1712, , , 41995,  , , 3HBm 1.7p ELEGANTE L
A145 96AA, PV, ALFA, 145, 1996, 3HBm, 1.6, , L, , , P, , 4, 1596, , , 32995,  , , 3HBm 1.6p L
A145 96AB, PV, ALFA, 145, 1996, 3HBm, 1.7, ELEGANTE, L, , , P, , 4, 1712, , , 41995,  , , 3HBm 1.7p ELEGANTE L
A145 97AA, PV, ALFA, 145, 1997, 3HBm, 1.6, , L, , , P, , 4, 1596, , , 32995,  , , 3HBm 1.6p L
A145 97AB, PV, ALFA, 145, 1997, 3HBm, 1.7, ELEGANTE, L, , , P, , 4, 1712, , , 41995,  , , 3HBm 1.7p ELEGANTE L
A145 98AA, PV, ALFA, 145, 1998, 3HBm, 1.6, , L, , , P, , 4, 1596, , , 32995,  , , 3HBm 1.6p L
A145 98AB, PV, ALFA, 145, 1998, 3HBm, 1.7, ELEGANTE, L, , , P, , 4, 1712, , , 41995,  , , 3HBm 1.7p ELEGANTE L
A145 98AC, PV, ALFA, 145, 1998, 4SDm, 2.5, , , , , P, , 5, 2492, , , 65998,  , , 4SDm 2.5p
A145 99AA, PV, ALFA, 145, 1999, 3HBm, 1.7, ELEGANTE, L, , , P, , 4, 1712, , , 41995,  , , 3HBm 1.7p ELEGANTE L
A145 99AB, PV, ALFA, 145, 1999, 3HBm, 1.6, , L, , , P, , 4, 1596, , , 32995,  , , 3HBm 1.6p L
A146 00AA, PV, ALFA, 146, 2000, 5HBm, 1.6, , TS, , , P, , 5, 1596, , , 37995,  , , 5HBm 1.6p TS
A146 01AA, PV, ALFA, 146, 2001, 5HBm, 1.6, , TS, , , P, , 5, 1596, , , 38995,  , , 5HBm 1.6p TS

first few rows of id_ad_link

4   10  DHJT 94AA   1994    REDUNDANT   HIJET
12  971 A33  95AA   1995    REDUNDANT   ALFA33
13  971 A33  95AB   1995    REDUNDANT   ALFA33
14  971 A33  95AC   1995    REDUNDANT   ALFA33
61  973 A146 95AB   1995    REDUNDANT   146
60  973 A146 95AA   1995    REDUNDANT   146
59  973 A145 02AB   2002    REDUNDANT   145
58  973 A145 02AA   2002    REDUNDANT   145
57  973 A145 01AB   2001    REDUNDANT   145
56  973 A145 01AA   2001    REDUNDANT   145
55  973 A145 00AB   2000    REDUNDANT   145
54  973 A145 99AB   1999    REDUNDANT   145
53  973 A145 99AA   1999    REDUNDANT   145
52  973 A145 98AC   1998    REDUNDANT   145
45  973 A145 95AB   1995    REDUNDANT   145
44  973 A145 95AA   1995    REDUNDANT   145
70  973 A146 98AB   1998    REDUNDANT   146
71  973 A146 98AC   1998    REDUNDANT   146
72  973 A146 99AA   1999    REDUNDANT   146
73  973 A146 00AA   2000    REDUNDANT   146

UPDATE:

here’s the result of

explain SELECT * FROM autotalk_identicar_old.ad_vehicle 
left join autotalk_identicar_old.id_ad_link on autotalk_identicar_old.ad_vehicle.vehiclekey=autotalk_identicar_old.id_ad_link.rbvehiclekey;

id, select_type, table,       type,    possible_keys, key,  key_len, ref, rows,   Extra
'1', 'SIMPLE', 'ad_vehicle', 'ALL',        NULL,     NULL,   NULL,  NULL, '60433', ''
'1', 'SIMPLE', 'id_ad_link', 'ALL',        NULL,     NULL,   NULL,  NULL, '25571', ''
  • 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-15T21:27:44+00:00Added an answer on June 15, 2026 at 9:27 pm

    Try creating an index on the foreign key:

    create index id_ad_link_rbvehiclekey_index on id_ad_link(rbvehiclekey);
    

    Without this index, each row of ad_vehicle will cause a full tablescan on id_ad_link.
    With the index, each row of ad_vehicle will result in a few index pages being accessed (probably in-memory) and as few pages read to fetch the joined rows, because the index stores the page(s) to find the rows.

    Minimizing disk I/O is critical to performance, because it’s at least 1000 times slower than memory operations.

    Indexes make a huge difference, especially on columns used for joins (like foreign keys)

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.