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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:59:05+00:00 2026-05-21T15:59:05+00:00

This query takes about 9 seconds and returns 2 records. SELECT s.description, s.improvement, s.first_name,

  • 0

This query takes about 9 seconds and returns 2 records.

SELECT

s.description, s.improvement,
s.first_name, s.last_name, s.finding, s.action, s.share, 
s.learned, s.timestamp, d.title as department_title, 
group_concat(DISTINCT g.title SEPARATOR " | ") as strategic_goals,
group_concat(DISTINCT m.statement SEPARATOR " | ") as mission_references,
group_concat(DISTINCT meas.statement SEPARATOR " | ") as measure_statement,
group_concat(DISTINCT o.statement SEPARATOR " | ") as outcome_statement,
group_concat(DISTINCT i.title SEPARATOR " | ") as ilo_title,
group_concat(DISTINCT cv.title SEPARATOR " | ") as core_value_title,
y1.year as current_year_title, y2.year as previous_year_title,
u.file_name as file_name

FROM summary s

LEFT JOIN year y1 ON s.current_year_id = y1.id
INNER JOIN year y2 ON s.previous_year_id = y2.id

INNER JOIN strategic_goal_entries sge ON s.id = sge.summary_id
INNER JOIN goal g ON sge.goal_id = g.id

INNER JOIN outcome o ON s.id = o.summary_id
LEFT JOIN measure meas ON o.id = meas.outcome_id

INNER JOIN department d ON s.department_id = d.id
LEFT JOIN uploads u ON s.id = u.summary_id 

INNER JOIN mission_entries me ON s.id = me.summary_id
LEFT JOIN mission m ON me.mission_id = m.id

LEFT JOIN ilo_entries ie ON s.id = ie.summary_id
LEFT JOIN ilo i ON ie.ilo_id = i.id

INNER JOIN core_value_entries cve ON s.id = cve.summary_id
INNER JOIN core_value cv ON cve.core_value_id = cv.id

INNER JOIN executive_of_department eod ON s.department_id = eod.department_id

WHERE eod.executive_id = 3

GROUP BY s.id

I added the rest of the primary keys. Query went from 9 seconds to 2 seconds.

Then I set fields that refer to other table’s primary keys, as index fields. The query went from 2 seconds to 20 seconds, did I assign too many indexes?

What are some ways I could speed this up?

  • 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-21T15:59:06+00:00Added an answer on May 21, 2026 at 3:59 pm

    1. After setting indexes, etc. you can speed up a little by limiting the JOIN conditions. For example, instead of

    LEFT JOIN uploads u ON s.id = u.summary_i
    

    do

    LEFT JOIN uploads u ON (s.id = u.summary_i AND s.id = 3)
    

    The WHERE clause is evaluated after all tables have been joined. Preciese your JOIN condition when you can.


    2. Did you try constructing a view from your select and perform a SELECT * FROM myView WHERE myView.id = 3 ?

    UPDATE : read this blog comment.

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

Sidebar

Related Questions

In this query: SELECT COUNT(*) AS UserCount, Company.* FROM Company LEFT JOIN User ON
I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted
I have this query statement and want to only get records that has a
In SQL server 2005 this query select len(cast('the quick brown fox jumped over the
I have a L2S query with several joins that should returns 11 records in
I've trying to optimize a query on MySQL that takes around 15-20 seconds to
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in
This query is related to this one I asked yesterday. I have a radio
this query will just one row as a result myDataContext db = new myDataContext();
I'm using this query to get all employees of {clients with name starting with

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.