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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:42:33+00:00 2026-06-09T12:42:33+00:00

I have the following 3 tables: publications (primary key = article ) article |

  • 0

I have the following 3 tables:

publications (primary key = article)

article | title | pubType 

authors (primary key = *author_name*)

author_name | author_somethingelse

pub_author_map

article | author_name 

Given a value for pubType, I need to select information about the articles, including authors. To do this, I have

SELECT p.article, p.title, p.dateTime, pam.author_name FROM publications p 
LEFT JOIN pub_author_map pam ON pam.article = p.article
LEFT JOIN authors a ON a.author_name = pam.author_name
WHERE p.pubType = '$pubType' ORDER BY p.article LIMIT 10

Even with a LIMIT 10, this query clocked in at about 29s. There are 1500 rows in publications and 3000 rows in pub_author_map.

How can I optimize the above query?

  • 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-09T12:42:34+00:00Added an answer on June 9, 2026 at 12:42 pm

    Add indicies

    • pub_author_map on column article

    • publications on column pubType

    for example like this.

    CREATE INDEX pub_author_idx_1 
        ON pub_author_map (article);
    
    CREATE INDEX publications_idx_1
        ON publications (pubType);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following tables: Profiles: ProfileID (Primary Key) ProfileName, etc. Contacts: ContactID (Primary Key)
I have the following tables: Student Data Student ID (primary key) Prior Education Student
I have the following tables in my SQL Database: authors: name varchar id int
I have following tables in my database: SuggestionsLog Table: ID, Title, Description. Employee Table:
I have the following tables in Core Data: Cinema (movies) Movie (title, times) DateTime
I have the following tables: CATEGORIES -- entry_id, cat_id TITLES -- entry_id, title DATA
I have the following tables: thread: id, title, content, created thread_tags: tag_id, thread_id tag:
Given the following tables in ActiveRecord: authors sites articles I don't know how to
I have following tables articles_category id title sef_title articles_data id cat_id title sef_title details
I have the following tables in my DB: id title heading content date tags

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.