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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:08:09+00:00 2026-05-16T02:08:09+00:00

When i execute this query it seems to cause the mysqld.exe process to use

  • 0

When i execute this query it seems to cause the mysqld.exe process to use 50-100% of my cpu.

Any ideas why.

SELECT m.draw_id , m.mobile, m.fly_buys, m.signup_date,
  IF(m.club = 1, 'Yes', 'No') AS club,
  IF(w.code != '', w.code, 
     IF(f.code != '', f.code, 
        IF(t.code != '', t.code, 'Unknown') ) ) AS code,
  IF(w.code != '', 'General', 
     IF(f.code != '', '5 pt', 
        IF(t.code != '', '10 pt', 'Unknown') ) ) AS code_type
  FROM action_6_members m
  LEFT JOIN action_6_5pts f ON f.member_id = m.id
  LEFT JOIN action_6_10pts t ON t.member_id = m.id
  LEFT JOIN action_6_weekly w ON w.member_id = m.id
  WHERE `draw_id` = '3' ORDER BY m.id DESC limit 0, 20;

Note: this does not return a massive amount of data (10 rows).
Note: although there are only 10 rows returned
action_6_5pts contains 40k rows
action_6_10_pts contains 25k rows
action_6_weekly contains 3.5million rows.


Update
So i have added an index and it is now working better.

Here is the basic table schematics.

action_6_5pts/10pts/weekly are all

code | member_id

CREATE TABLE `action_6_5pts` (
  `code` varchar(255) NOT NULL,
  `member_id` int(11) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `member_id` (`member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

action_6_members is
id | flybuys | bla | bla | bla

CREATE TABLE `action_6_members` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `draw_id` int(11) NOT NULL,
  `mobile` varchar(255) NOT NULL,
  `fly_buys` varchar(255) NOT NULL,
  `signup_date` datetime NOT NULL,
  `club` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1

so,

i need to return the code type for the member, and the actual code.

This information is not stored anywhere and the only way i can see to get it is to do a join on the tables based on the member_id of each user.

Is there a faster/better way of doing this without altering the table structure?

  • 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-16T02:08:09+00:00Added an answer on May 16, 2026 at 2:08 am

    because your query is quite beefy

    40k x 25k x 3.5m

    joined rows need to be considered. Have you indexed on all the columns you are using in your join?

    http://www.wolframalpha.com/input/?i=40000+x+25000+x+3500000

    thats a lot of data.

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

Sidebar

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.