假设我有下面的 SQL
如何优化查询的性能?
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