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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:46:33+00:00 2026-06-08T07:46:33+00:00

I am facing performance issue, while running a SQL query that uses MyISAM database.

  • 0

I am facing performance issue, while running a SQL query that uses MyISAM database.

To brief this, I have 3 tables:
Table: A (Engine MyISAM. Total Records: 1847)
Table: B (Engine MyISAM. Total Records: 1110)
Table: C (Engine MyISAM. Total Records: 57867)

Now the query I am running is taking 623 seconds to get execute and sometime it happens that connection from server(same is the case with localhost) gets aborted.

Below is the query I am executing:

SELECT MATCH(A.title, A.description) AGAINST('Computer Graphic Artist') AS 'Score',
    A.code AS 'Code',
    B.cluster AS 'Cluster',
    B.pathway AS 'Pathway',
    A.title AS 'Role',
    A.description AS 'Description'
FROM B
INNER JOIN A ON B.code = A.code
INNER JOIN C ON B.code = C.code
WHERE MATCH(A.title, A.description) AGAINST('Computer Graphic Artist')
  OR MATCH(B.cluster, B.pathway, B.descripton) AGAINST('Computer Graphic Artist')
  OR MATCH(C.title) AGAINST('Computer Graphic Artist')
ORDER BY Score DESC, B.cluster ASC

You can also refer to Pastie (if you feel trouble seeing this SQL). I have added FULLTEXT property wherever it is applicable.

NOTE: Table A, B and C have few duplicate records as well.

Please let me know, how I can optimize this SQLfor fast output.

  • 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-08T07:46:35+00:00Added an answer on June 8, 2026 at 7:46 am

    The first thing to do is to make sure that you have a FULLTEXT index in place on the exact set of columns you are querying from each table:

    alter table A add fulltext index a_fti (title,description);
    alter table B add fulltext index b_fti (cluster, pathway, descripton);
    alter table C add fulltext index c_fti (title);
    

    Then I would recommend rewriting your query to use UNION instead of OR. I’ve gotten much better performance from FULLTEXT searches in particular in MySQL using this approach.

    Here’s an example using your query:

    select Score, Code, Cluster, Pathway, Role, Description
    from
    (
    SELECT MATCH(A.title, A.description) AGAINST('Computer Graphic Artist') AS 'Score',
        A.code AS 'Code',
        B.cluster AS 'Cluster',
        B.pathway AS 'Pathway',
        A.title AS 'Role',
        A.description AS 'Description'
    FROM B
    INNER JOIN A ON B.code = A.code
    INNER JOIN C ON B.code = C.code
    WHERE MATCH(A.title, A.description) AGAINST('Computer Graphic Artist')
    UNION
    SELECT MATCH(A.title, A.description) AGAINST('Computer Graphic Artist') AS 'Score',
        A.code AS 'Code',
        B.cluster AS 'Cluster',
        B.pathway AS 'Pathway',
        A.title AS 'Role',
        A.description AS 'Description'
    FROM B
    INNER JOIN A ON B.code = A.code
    INNER JOIN C ON B.code = C.code
    WHERE MATCH(B.cluster, B.pathway, B.descripton) AGAINST('Computer Graphic Artist')
    UNION
    SELECT MATCH(A.title, A.description) AGAINST('Computer Graphic Artist') AS 'Score',
        A.code AS 'Code',
        B.cluster AS 'Cluster',
        B.pathway AS 'Pathway',
        A.title AS 'Role',
        A.description AS 'Description'
    FROM B
    INNER JOIN A ON B.code = A.code
    INNER JOIN C ON B.code = C.code
    WHERE MATCH(C.title) AGAINST('Computer Graphic Artist')
    ) as sub_query
    ORDER BY Score DESC, Cluster ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Facing some issue in Talend Admin Console, the jobs that are running from IDE
We have an WCF application which uses NHibernate to query data from the database.
issue facing while loading the messages in to mq channel, recieving an error like
I’m facing an issue with NHibernate performance and can you please suggest me some
I am facing performance issues while reading/writing data from/to MS-Excel cells. I am using
I'm facing a performance issue with a crowded combobox (5000 items). Rendering of the
Im facing problem with poor performance of css prompting mechanism. Can I dissable this
i have this piece of code that selects all users from the table and
I'm currently facing a performance problem with creating POCO objects from my database. I'm
I am facing a performance (it can lead to scaling issue later on) issue

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.