This document discusses using indexes in SQL to improve query performance. It shows how creating a nonclustered index on columns in a table can change a query from doing a full table scan to an index scan, using fewer I/O resources. It also examines how different indexes may perform differently for the same query based on the column indexed. The document demonstrates checking index fragmentation and shows how a uniqueidentifier primary key can become fragmented over time with multiple inserts.
This document discusses using indexes in SQL to improve query performance. It shows how creating a nonclustered index on columns in a table can change a query from doing a full table scan to an index scan, using fewer I/O resources. It also examines how different indexes may perform differently for the same query based on the column indexed. The document demonstrates checking index fragmentation and shows how a uniqueidentifier primary key can become fragmented over time with multiple inserts.
In only 3 months, Lenovo, the leader of PC and mobile device manufacturing, developed three solutions together with SAP giving end users mobile access to SAP HANA, BW and CRM via an intuitive non SAP user interface levering SAP NetWeaver Gateway. The lean architecture with Netweaver Gateway is verified and proved to be effective and efficient for mobile consumption. In this presentation from TechEd Shanghai where SAP and Lenovo presented the success story together.
In only 3 months, Lenovo, the leader of PC and mobile device manufacturing, developed three solutions together with SAP giving end users mobile access to SAP HANA, BW and CRM via an intuitive non SAP user interface levering SAP NetWeaver Gateway. The lean architecture with Netweaver Gateway is verified and proved to be effective and efficient for mobile consumption. In this presentation from TechEd Shanghai where SAP and Lenovo presented the success story together.
43. 解法-2
用Filtered Indexes
CREATE NONCLUSTERED INDEX
NCIDX_BAR_CODE_FILTER
ON [dbo].[LOL_LEV] (BAR_CODE)
WHERE BAR_CODE IS NOT NULL ;
GO
使用Filtered Index要注意的地方
43
44. 解法-3
Index + 改Query
CREATE NONCLUSTERED INDEX NCIDX_BAR_CODE
ON [dbo].[LOL_LEV] (BAR_CODE)
GO
WHERE
LEFT(BAR_CODE,7)=dbo.fnDATE_CHANGE(CONVERT(VARCHAR,GETDATE(),1
12),2)
改成
WHERE BAR_CODE >
dbo.fnDATE_CHANGE(CONVERT(VARCHAR,GETDATE(),112),2) + '000' and
BAR_CODE < dbo.fnDATE_CHANGE(CONVERT(VARCHAR,GETDATE(),112),2) +
'999'
44
USE ARTC_SOD20_M
GO
SELECT SRNO_CODE, SRNO_CODE_DESC, GIST_DESC
FROM dbo.FMMITEM WITH (INDEX(IX_FMMITEM_2))
WHERE SRNO_CODE = '1030001516'
--CREATE INDEX IX_FMITEM_2_1 ON dbo.FMMITEM
--(SRNO_CODE)
--INCLUDE(SRNO_CODE_DESC, GIST_DESC);
SELECT SRNO_CODE, SRNO_CODE_DESC, GIST_DESC
FROM dbo.FMMITEM WITH (INDEX(IX_FMITEM_2_1))
WHERE SRNO_CODE = '1030001516'