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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:56:12+00:00 2026-06-11T19:56:12+00:00

Suppose I have got the SQL below How can I optimize the performance of

  • 0

Suppose I have got the SQL below

How can I optimize the performance of the query ?

select product, address, quantity, 
    price, create_date, sum(no_of_photo) as no_of_photo
from
(
    SELECT customer.PROJECT_ID as project_id ,
        customer.ORDER_TYPE as order_type,  
        customer.product_name as product, 
        customer.address_name as address ,    
        customer.quantity_name as quantity,
        user.first_name || ' ' || user.last_name AS price,
        customer.create_date, customer.no_of_photo 
    FROM customer 
    INNER JOIN user 
        ON customer.creation_userid = user.userid
) master_list 
group by project_id, order_type , 
    product, address, quantity, price, 
    create_date 
having project_id = 123456 
order by product, address, quantity, price, create_date
  • 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-11T19:56:13+00:00Added an answer on June 11, 2026 at 7:56 pm

    A couple of things I would try:

    1. Put your HAVING clause into a WHERE in the inner query
    2. Select first_name and last_name on their own in inner query
    3. Group by first_name, last_name in outer query (why is it called price?)
    4. Do the concatenation of first_name || ‘ ‘ || last_name in outer query

    Also ensure there are indexes on:

    • customer.project_id
    • customer.creation_userid
    • user.userid
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have got a SQL like this select distinct CUSTOMER_PRODUCT_ORDER as ORDER from
Suppose I have an sql statement select a.Date, count(a.Id) as Apples from dbo.apples as
Suppose you have got a list of items along with their Weights[] and Price[]
i've got some weird query , so i have to execute raw SQL. The
Suppose I have got a model ArticleVersion in my project which is defined as:
suppose i have a .on() function wherein i select multiple ids $(#i, #am, #your,
So, I've got a query that looks something like this: SELECT id, DATE_FORMAT(CONVERT_TZ(callTime,'+0:00','-7:00'),'%b %d
Suppose you have got a bunch of files written in C, C++ or Fortran,
Suppose I have an SQL table entitled Facility which looks like this: || FacilityID
Suppose there are only two type of model objects. Tag Article Article can have

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.