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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:39:05+00:00 2026-05-11T13:39:05+00:00

Overview: I have three tables 1) subscribers, bios, and shirtsizes and i need to

  • 0

Overview:

I have three tables 1) subscribers, bios, and shirtsizes and i need to find the subscribers without a bio or shirtsizes

the tables are laid out such as

subscribers

| season_id |  user_id | 

bio

| bio_id | user_id | 

shirt sizes

| bio_id | shirtsize | 

And I need to find all users who do not have a bio or shirtsize, (if no bio; then no shirtsize via relation) for any given season.

I originally wrote a query like:

SELECT *    FROM subscribers s     LEFT JOIN bio b ON b.user_id = subscribers.user_id     LEFT JOIN shirtsizes ON shirtsize.bio_id = bio.bio_id  WHERE s.season_id = 185181 AND (bio.bio_id IS NULL OR shirtsize.size IS NULL); 

but it is taking 10 seconds to complete now.

I am wondering how I can restructure the query (or possibly the problem) so that it will preform reasonably.

Here is the mysql explain: (ogu = subscribers, b = bio, tn = shirtshize)

| id | select_type | table | type  | possible_keys | key     | key_len | ref         | rows   | Extra       |    +----+-------------+-------+-------+---------------+---------+---------+-------------+--------+-------------+     |  1 | SIMPLE      | ogu   | ref   | PRIMARY       | PRIMARY | 4       | const       |    133 | Using where | |  1 | SIMPLE      | b     | index | NULL          | PRIMARY | 8       | NULL        | 187644 | Using index | |  1 | SIMPLE      | tn    | ref   | nid           | nid     | 4       | waka2.b.nid |      1 | Using where |  

The above is pretty sanitized, here’s the realz info:

mysql> DESCRIBE subscribers +-----------+---------+------+-----+---------+-------+ | Field     | Type    | Null | Key | Default | Extra | +-----------+---------+------+-----+---------+-------+ | subscribers  | int(11) | NO   | PRI |         |       |  | uid       | int(11) | NO   | PRI |         |       |    mysql> DESCRIBE bio; +-------+------------------+------+-----+---------+-------+ | Field | Type             | Null | Key | Default | Extra | +-------+------------------+------+-----+---------+-------+ | bio_id   | int(10) unsigned | NO   | PRI | 0       |       |  | uid   | int(10) unsigned | NO   | PRI | 0       |       |    mysql> DESCRIBE shirtsize; +-------+------------------+------+-----+---------+-------+ | Field | Type             | Null | Key | Default | Extra | +-------+------------------+------+-----+---------+-------+ | bio_id   | int(10) unsigned | NO   | PRI | 0       |       |  | shirtsize   | int(10) unsigned | NO   | PRI | 0       |       |  

and the real query looks like:

SELECT ogu.nid, ogu.is_active, ogu.uid, b.nid AS bio_node, tn.nid AS size                   FROM og_uid ogu                   LEFT JOIN bio b ON b.uid = ogu.uid                   LEFT JOIN term_node tn ON tn.nid = b.nid                   WHERE ogu.nid = 185033 AND ogu.is_admin = 0                   AND (b.nid IS NULL OR tn.tid IS NULL) 

nid is season_id or bio_id (with a type); term_node is going to be the shirtsize

  • 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. 2026-05-11T13:39:05+00:00Added an answer on May 11, 2026 at 1:39 pm

    The query should be OK. I would run it through a query analyzer and refine the indexes on the tables.

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

Sidebar

Related Questions

OverView I'm having problem with Ajax Tab Container ,I have added three tabs in
I have a document that is an overview document within a folder, there are
Overview I have an iOS app which sends local notifications at specific dates. I
Overview: I have an advancedDataGrid that I am using a GroupingCollection on and I
Overview I have an iOS project which contains 2 navigation controllers as shown in
I have an overview drawing of a plant and I want to show the
I have a overview page containing a list with some links from which multiple
So I have been tasked with modifying the Stories Overview report for TFS. I
Problem Overview: My application has an enrollment form. Users have a habit of entering
I just started a graphical C++ course and I have problem getting an overview

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.