-4
Q
最近昂貴的查詢
A
回答
0
您正在使用2子查詢的結果是更Cosltier,你可以用聯接或臨時表替換你的子查詢。
此外,您還可以索引行程表的VehicleSchedules表和vehicleScheduleid列的SchedStartTime。
注意:索引會影響您的DML查詢。
select top 1 @v_CancelScheduleid= VehicleScheduleid
from VehicleSchedules WITH (NOLOCK)
where [email protected]_VehicleId
and vehicleScheduleid not in (select isnull(vehicleScheduleid,0) from trip WITH (NOLOCK)) and SchedStartTime<(select SchedStartTime from VehicleSchedules WITH (NOLOCK) where [email protected]) order by SchedStartTime desc
相關問題
- 1. 如何登錄並查找最昂貴的查詢?
- 2. ServiceStack Redis - 緩存昂貴的查詢
- 3. 加速昂貴的SQL查詢
- 4. 昂貴的StaticResource
- 5. 查找Couchbase所有者的昂貴查詢(CPU)
- 6. 是destroyDrawingCache()查看昂貴的操作嗎?
- 7. Thread.getStackTrace()有多昂貴?
- 8. 是「ConnectionMultiplexer.IsConnected」昂貴嗎?
- 9. pthread_self()是否昂貴?
- 10. SurfaceHolder.lockCanvas()過於昂貴
- 11. CreateThread()有多昂貴?
- 12. ActiveRecord爲與MySQL的has_and_belongs_to_many關係生成昂貴的DESCRIBE查詢
- 13. 有沒有辦法在特定時間內找到最昂貴的查詢?
- 14. 查找MySQL中第二個最昂貴的總產品
- 15. 如何在jxpath中實現昂貴的查詢?
- 16. Rails印象派製作昂貴的查詢
- 17. 從查詢集到列表,是昂貴的操作?
- 18. 在內存或數據庫中緩存昂貴的SQL查詢?
- 19. 如何從Rails中取消昂貴的Postgresql查詢?
- 20. 在rails中重構一個昂貴的查詢
- 21. MySQL查詢 - 它們真的有多昂貴?
- 22. Yii動態下拉菜單 - 昂貴的查詢
- 23. 在RoR中緩存昂貴的查詢結果
- 24. 使用昂貴的INNER JOIN優化MySQL查詢
- 25. 如何昂貴或昂貴是用C++繼承
- 26. 爲什麼類型檢查昂貴?
- 27. 處理碰撞 - 陣列查找昂貴
- 28. UITableView的reloadData有多昂貴?
- 29. d3的selection.text()價格昂貴
- 30. 在TEMP表空間方面查詢有多昂貴?
查詢運行了多長時間? –
你正在使用哪個dbms? – jarlh
MS SQL SERVER 2012 .... – Sanal