注 - db中有大約2-3百萬條記錄。爲什麼我的查詢需要2分鐘才能運行?
SELECT
route_date, stop_exception_code, unique_id_no,
customer_reference, stop_name, stop_comment,
branch_id, customer_no, stop_expected_pieces,
datetime_updated, updated_by, route_code
FROM
cops_reporting.distribution_stop_information distribution_stop_information
WHERE
(stop_exception_code <> 'null') AND
(datetime_updated >= { ts '2011-01-25 00:00:01' })
ORDER BY datetime_updated DESC
什麼數據庫引擎? – Blorgbeard 2011-01-27 16:59:55
您需要添加更多關於模式和相關索引的信息。例如 - datetime_updated上有一個索引,它是什麼類型的索引?連接列上是否有索引? – iain 2011-01-27 17:01:22