數據庫服務器是Microsoft SQL Server,但我沒有管理員訪問權限。 所以,我不知道哪個版本,我不知道哪些索引存在。任何人都可以優化這條SQL語句嗎?
要訪問數據庫,我正在使用ADO。
這裏是SQL語句:
-- Get master objid and order_number and activity time
SELECT A.objid,
A.order_number,
F.entry_time
-- From these tables
FROM dbo.table_master as A,
dbo.table_activity as F
-- link of the tables
WHERE F.objid = A.objid
-- Retrieve code = 1900 only
AND F.code = 1900
-- Which have info like this:
AND F.info LIKE '%to SUPPORT.'
-- And entry time between these times:
AND F.entry_time >= '2011-10-01 00:00:00'
AND F.entry_time <= '2011-12-05 23:59:59'
-- We want the earliest entry (because there might be multiple code = 900 and info like)
ORDER by F.entry_time
是否有可能進行優化呢?
謝謝
它特別慢嗎?你能顯示查詢計劃嗎?另外,這個SQL的味道是什麼(SQL Server,MySQL等)? – jadarnel27
您是否嘗試過從SSMS訪問數據庫? –
@ jadarnel27:OP說這是SQLServer。 –