OPTIMIZE FOR 貎朱Μ瑚 蟆朱. (2005 覯 危) OPTIMIZE FOR 襦貉覲襯 牛磯伎螳 襦貉覲 覿れ煙朱 豕 貎朱Μ螻 語一 覈詩 蟆曙 牛磯伎蟆 糾覲企ゼ 伎 襦 螳 螻牛蠍 . OPTIMIZE FOR 覈 螳 貎朱Μ 豕 襷 螻 ろ 讌 . (襦貉覲 覓語
Magic Density襯 谿瑚.)
USE AdventureWorks;
GO
EXEC sp_helpindex 'Person.Address';
/*
rowguid
AddressLine1, AddressLine2, City, StateProvinceID, PostalCode
StateProvinceID
AddressID
*/
create index nix_postal_code
on Person.Address(PostalCode);
go
DECLARE @city_name nvarchar(30);
DECLARE @postal_code nvarchar(15);
SET @postal_code = 86171;
--sql1
SELECT * FROM Person.Address
WHERE City = @city_name AND PostalCode = @postal_code
OPTION ( OPTIMIZE FOR (@city_name = 'Seattle', @postal_code UNKNOWN) );