-1
我有以下查詢需要時間來執行。我認爲這是由於分組。任何人都可以修改此查詢並執行查詢而不使用GroupBy,但輸出結果應該相同。緩慢查詢執行
SELECT order_id,
sum(item_total)item_total,
sum(discount)discount,
sum(shipping_amount)shipping_amount,
sum(tax_total)tax_total,
sum(grand_total)grand_total,
order_status,
order_date,
store_label,
promotion_key,
store_identifier,
ship_party_name,
ship_address1,
ship_address2,
ship_city,
ship_zip,
ship_state,
ship_to_phone,
ship_type,
bill_party_name,
bill_address1,
bill_address2,
bill_city,
bill_state,
bill_zip,
bill_to_phone,
bill_to_email,
card_brand,
credit_card_number
FROM apps.SCHL_ORDER_DETAILS_V
WHERE UCN=?
AND order_id=?
GROUP BY order_id,
order_status,
order_date,
store_label,
promotion_key,
store_identifier,
bill_party_name,
bill_address1,
bill_address2,
bill_city,
bill_state,
bill_zip,
bill_to_phone,
bill_to_email,
card_brand,
credit_card_number,
ship_party_name,
ship_address1,
ship_address2,
ship_city,
ship_zip,
ship_state,
ship_to_phone,
ship_type,
store_label
如果u需要聚集那麼你無法避免它,我認爲...首先我們需要解釋計劃和表格行數,DDL(可能爲apps.SCHL_ORDER_DETAILS_V表或視圖) – Thomas