Hitesh K Gupta Ответов: 2

Как сократить время выполнения запроса с помощью полнотекстового поиска и огромных данных


Вот структура моей таблицы:
CREATE TABLE [dbo].[TradeMark](
	[SerialNo] [nvarchar](250) NOT NULL,
	[RegistrationNo] [nvarchar](250) NOT NULL,
	[MarkIdentification] [nvarchar](max) NULL,
	[Status] [int] NULL,
	[USClassId] [nvarchar](1000) NOT NULL,
	[TypeCode] [nvarchar](100) NULL,
	[Casefilestatementstext] [nvarchar](max) NULL,
	[OwnerName] [nvarchar](200) NULL,
	[OwnerType] [int] NULL,
	[Filename] [nvarchar](1000) NOT NULL,
	[PreviousFileName] [nvarchar](200) NULL,
	[UpdateIteration] [int] NOT NULL CONSTRAINT [DF_TradeMark_UpdateIteration]  DEFAULT ((0)),
	[NewCasefilestatementstext] [nvarchar](max) NULL,
	[TrademarkId] [bigint] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_Trademark_TrademarkId] PRIMARY KEY CLUSTERED 
(
	[TrademarkId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UK_Trademark_SerialNo] UNIQUE NONCLUSTERED 
(
	[SerialNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

Таблица содержит более 3 миллионов записей, и мне нужно применить полнотекстовый поисковый запрос (на самом деле очень огромный запрос). вот запрос и его ответ:

select Top 10 SerialNo, Registrationno,Status,MarkIdentification,OwnerName,Casefilestatementstext from Trademark where 
(MarkIdentification LIKE '% CALIDOUBLE %' 
OR MarkIdentification LIKE 'CALIDOUBLE %' 
OR MarkIdentification LIKE 'CALIDOUBLEs %' 
OR MarkIdentification LIKE '% CALIDOUBLEs %' 
OR MarkIdentification LIKE 'CALIDOUBLE''s %' 
OR MarkIdentification LIKE 'CALIDOUBLE''s%'  
OR MarkIdentification LIKE 'CALIDOUBLE' 
OR MarkIdentification LIKE '%-CALIDOUBLE' 
OR MarkIdentification LIKE '% CALIDOUBLE')  
AND ( 
USClassId like  '%001%' OR USClassId like  '%023%' OR USClassId like  '%027%' OR USClassId like  '%034%' 
OR USClassId like  '%038%' OR USClassId like  '%039%' OR USClassId like  '%045%' OR USClassId like  '%046%' 
OR USClassId like  '%047%' OR USClassId like  '%048%' OR USClassId like  '%100%' OR USClassId like  '%101%' 
OR USClassId like  '%104%' OR USClassId like  '%105%' OR USClassId like  '%107%' ) 
AND ((Casefilestatementstext like '%Ale%') 
OR(Casefilestatementstext like '%Ales%') 
OR(Casefilestatementstext like '%Apron%') 
OR(Casefilestatementstext like '%Aprons%') 
OR(Casefilestatementstext like '%Barbeque%') 
OR(Casefilestatementstext like '%Barbeques%') 
OR(Casefilestatementstext like '%Beany%') 
OR(Casefilestatementstext like '%Beanies%') 
OR(Casefilestatementstext like '%Beer%') 
OR(Casefilestatementstext like '%Beers%') 
OR(Casefilestatementstext like '%Beverage%') 
OR(Casefilestatementstext like '%Beverages%') 
OR(Casefilestatementstext like '%Blouse%') 
OR(Casefilestatementstext like '%Blouses%') 
OR(Casefilestatementstext like '%Bologna%') 
OR(Casefilestatementstext like '%Bolognas%') 
OR(Casefilestatementstext like '%Boot%') 
OR(Casefilestatementstext like '%Boots%') 
OR(Casefilestatementstext like '%Bread%') 
OR(Casefilestatementstext like '%Breads%') 
OR(Casefilestatementstext like '%Burger%') 
OR(Casefilestatementstext like '%Burgers%') 
OR(Casefilestatementstext like '%Cake%') 
OR(Casefilestatementstext like '%Cakes%') 
OR(Casefilestatementstext like '%Candy%') 
OR(Casefilestatementstext like '%Candies%') 
OR(Casefilestatementstext like '%Cap%') 
OR(Casefilestatementstext like '%Caps%') 
OR(Casefilestatementstext like '%Catsup%') 
OR(Casefilestatementstext like '%Catsups%') 
OR(Casefilestatementstext like '%Cattle%') 
OR(Casefilestatementstext like '%Cattle%') 
OR(Casefilestatementstext like '%Cheese%') 
OR(Casefilestatementstext like '%Cheese%') 
OR(Casefilestatementstext like '%Clock%') 
OR(Casefilestatementstext like '%Clocks%') 
OR(Casefilestatementstext like '%Coat%') 
OR(Casefilestatementstext like '%Coats%') 
OR(Casefilestatementstext like '%Coffee%') 
OR(Casefilestatementstext like '%Coffees%') 
OR(Casefilestatementstext like '%Collar%') 
OR(Casefilestatementstext like '%Collars%') 
OR(Casefilestatementstext like '%Cuff%') 
OR(Casefilestatementstext like '%Cuffs%') 
OR(Casefilestatementstext like '%Dress%') 
OR(Casefilestatementstext like '%Dresses%') 
OR(Casefilestatementstext like '%Espresso%') 
OR(Casefilestatementstext like '%Espressoes%') 
OR(Casefilestatementstext like '%Falafel%')
OR(Casefilestatementstext like '%Falafels%')
OR(Casefilestatementstext like '%Fish%')
OR(Casefilestatementstext like '%Fish%') 
OR(Casefilestatementstext like '%Flour%')
OR(Casefilestatementstext like '%Flours%')
OR(Casefilestatementstext like '%Food%')
OR(Casefilestatementstext like '%Foods%') 
OR(Casefilestatementstext like '%Frankfurter%')
OR(Casefilestatementstext like '%Frankfurters%')
OR(Casefilestatementstext like '%Ham%') 
OR(Casefilestatementstext like '%Hams%')
OR(Casefilestatementstext like '%Hamburger%')
OR(Casefilestatementstext like '%Hamburgers%')
OR(Casefilestatementstext like '%Hat%') 
OR(Casefilestatementstext like '%Hats%')
OR(Casefilestatementstext like '%Jacket%')
OR(Casefilestatementstext like '%Jackets%')
OR(Casefilestatementstext like '%Jean%') 
OR(Casefilestatementstext like '%Jeans%')
OR(Casefilestatementstext like '%Magazine%')
OR(Casefilestatementstext like '%Magazines%') 
OR(Casefilestatementstext like '%Marinade%')
OR(Casefilestatementstext like '%Marinades%')
OR(Casefilestatementstext like '%Meatball%') 
OR(Casefilestatementstext like '%Meatballs%')
OR(Casefilestatementstext like '%Milk%')
OR(Casefilestatementstext like '%Milk%')
OR(Casefilestatementstext like '%Mustard%') 
OR(Casefilestatementstext like '%Mustards%')
OR(Casefilestatementstext like '%Pajama%')
OR(Casefilestatementstext like '%Pajamas%')
OR(Casefilestatementstext like '%Pant%') 
OR(Casefilestatementstext like '%Pants%')
OR(Casefilestatementstext like '%Pasta%')
OR(Casefilestatementstext like '%Pastas%')
OR(Casefilestatementstext like '%Pecan%') 
OR(Casefilestatementstext like '%Pecans%')
OR(Casefilestatementstext like '%Pepperoni%')
OR(Casefilestatementstext like '%Pepperonis%')
OR(Casefilestatementstext like '%Pickle%') 
OR(Casefilestatementstext like '%Pickles%')
OR(Casefilestatementstext like '%Pie%')
OR(Casefilestatementstext like '%Pies%')
OR(Casefilestatementstext like '%Pizza%') 
OR(Casefilestatementstext like '%Pizzas%')
OR(Casefilestatementstext like '%Poultry%')
OR(Casefilestatementstext like '%Poultries%')
OR(Casefilestatementstext like '%Rice%') 
OR(Casefilestatementstext like '%Rice%')
OR(Casefilestatementstext like '%Roast%')
OR(Casefilestatementstext like '%Roasts%')
OR(Casefilestatementstext like '%Roll%') 
OR(Casefilestatementstext like '%Rolls%')
OR(Casefilestatementstext like '%Salami%')
OR(Casefilestatementstext like '%Salamis%')
OR(Casefilestatementstext like '%Salsa%') 
OR(Casefilestatementstext like '%Salsas%')
OR(Casefilestatementstext like '%Sandwich%')
OR(Casefilestatementstext like '%Sandwiches%')
OR(Casefilestatementstext like '%Sauce%') 
OR(Casefilestatementstext like '%Sauces%')
OR(Casefilestatementstext like '%Sausage%')
OR(Casefilestatementstext like '%Sausages%')
OR(Casefilestatementstext like '%Seasoning%') 
OR(Casefilestatementstext like '%Seasonings%')
OR(Casefilestatementstext like '%Shirt%')
OR(Casefilestatementstext like '%Shirts%')
OR(Casefilestatementstext like '%Short%') 
OR(Casefilestatementstext like '%Shorts%')
OR(Casefilestatementstext like '%Slack%')
OR(Casefilestatementstext like '%Slacks%')
OR(Casefilestatementstext like '%Smoothy%') 
OR(Casefilestatementstext like '%Smoothies%')
OR(Casefilestatementstext like '%Spice%')
OR(Casefilestatementstext like '%Spices%')
OR(Casefilestatementstext like '%Stout%') 
OR(Casefilestatementstext like '%Stouts%')
OR(Casefilestatementstext like '%Sugar%')
OR(Casefilestatementstext like '%Sugars%')
OR(Casefilestatementstext like '%Suit%') 
OR(Casefilestatementstext like '%Suits%')
OR(Casefilestatementstext like '%Sweater%')
OR(Casefilestatementstext like '%Sweaters%')
OR(Casefilestatementstext like '%Sweatshirt%') 
OR(Casefilestatementstext like '%Sweatshirts%')
OR(Casefilestatementstext like '%Syrup%')
OR(Casefilestatementstext like '%Syrups%')
OR(Casefilestatementstext like '%Tie%') 
OR(Casefilestatementstext like '%Ties%')
OR(Casefilestatementstext like '%Trouser%')
OR(Casefilestatementstext like '%Trousers%')
OR(Casefilestatementstext like '%T-shirts%') 
OR(Casefilestatementstext like '%T-shirts%')
OR(Casefilestatementstext like '%Underwear%')
OR(Casefilestatementstext like '%Underwears%')
OR(Casefilestatementstext like '%Watch%') 
OR(Casefilestatementstext like '%Watches%')
OR(Casefilestatementstext like '%Wine%')
OR(Casefilestatementstext like '%Wines%') 
) 
AND (
OR( CONTAINS(Casefilestatementstext,'NEAR((Bakery,good), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Bakeries,good), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Bakery,goods), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Bakeries,goods), 6)'))  
OR( CONTAINS(Casefilestatementstext,'NEAR((Bean,garbanzo,processed), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beans,garbanzo,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Bean,garbanzoes,processed), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beans,garbanzoes,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Bean,garbanzo,processeds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beans,garbanzo,processeds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Bean,garbanzoes,processeds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beans,garbanzoes,processeds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((beauty,contest), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((beauties,contest), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((beauty,contests), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((beauties,contests), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patty), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patty), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patties), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patties), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minced), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minced), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minceds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minceds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processeds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processeds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((beverage,station), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((beverages,station), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((beverage,stations), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((beverages,stations), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverage,maltless), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverages,maltless), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverage,maltlesses), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverages,maltlesses), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverage,non-alcoholic), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverages,non-alcoholic), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverage,non-alcoholic), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beverages,non-alcoholic), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((boat,cruis), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((boats,cruis), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((boat,cruises), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((boats,cruises), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Bread,mix), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Breads,mix), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Bread,mixes), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Breads,mixes), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Bread,pocket), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Breads,pocket), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Bread,pockets), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Breads,pockets), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Cake,mix), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Cakes,mix), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Cake,mixes), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Cakes,mixes), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,beverage), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,beverage), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,beverage), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,beverage), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,beverages), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,beverages), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,beverages), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,beverages), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,food), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,food), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,food), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,food), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,foods), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,foods), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((catering,foods), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((caterings,foods), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Chicken,prepared), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Chickens,prepared), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Chicken,prepareds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Chickens,prepareds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Chickpea,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Chickpeas,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Chickpea,processeds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Chickpeas,processeds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((coffee,certification), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((coffees,certification), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((coffee,certifications), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((coffees,certifications), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((coffee,shop), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((coffees,shop), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((coffee,shops), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((coffees,shops), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((concession,stand), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((concessions,stand), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((concession,stands), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((concessions,stands), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((convenience,store), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((conveniences,store), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((convenience,stores), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((conveniences,stores), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((cooking,cours), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((cookings,cours), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((cooking,courses), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((cookings,courses), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((cooking,lecture), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((cookings,lecture), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((cooking,lectures), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((cookings,lectures), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Cottage,cheese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Cottages,cheese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Cottage,cheeses), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Cottages,cheeses), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Custard,frozen), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Custards,frozen), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Custard,frozens), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Custards,frozens), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concert,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concert,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concert,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concert,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concerts,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concerts,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concerts,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concerts,production), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concert,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concert,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concert,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concert,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concerts,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concerts,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,concerts,productions), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,concerts,productions), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,firework), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,firework), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,firework), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,firework), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,fireworks), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,fireworks), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,fireworks), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,fireworks), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hosting,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hosting,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hosting,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hosting,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hostings,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hostings,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hostings,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hostings,party), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hosting,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hosting,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hosting,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hosting,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hostings,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hostings,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainment,hostings,parties), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((entertainments,hostings,parties), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,glaze), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,glaze), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,glazes), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,glazes), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rub,dry), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rub,dry), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rubs,dry), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rubs,dry), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rub,dries), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rub,dries), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rubs,dries), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fish,rubs,dries), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((food,delivery), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((foods,delivery), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((food,deliveries), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((foods,deliveries), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((food,preparation), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((foods,preparation), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((food,preparations), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((foods,preparations), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,product), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,product), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,products), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,products), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,product,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,product,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,products,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,products,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,product,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,product,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,products,Chinese), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,products,Chinese), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,product,frozen), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,product,frozen), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,products,frozen), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,products,frozen), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,product,frozens), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,product,frozens), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Food,products,frozens), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Foods,products,frozens), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Fruit,drink), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fruits,drink), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fruit,drinks), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fruits,drinks), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryer,deep,fat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryers,deep,fat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryer,deeps,fat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryers,deeps,fat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryer,deep,fats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryers,deep,fats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryer,deeps,fats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Fryers,deeps,fats), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmet,shop,restaurant), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmets,shop,restaurant), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmet,shops,restaurant), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmets,shops,restaurant), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmet,shop,restaurants), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmets,shop,restaurants), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmet,shops,restaurants), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((gourmets,shops,restaurants), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Hot,dog), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Hots,dog), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Hot,dogs), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Hots,dogs), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((hotel,reservation), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((hotels,reservation), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((hotel,reservations), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((hotels,reservations), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,cream), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,cream), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,creams), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,creams), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bar), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bar), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bar), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bar), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bars), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bars), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bars), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,milk,bars), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavored,colored), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavored,colored), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavoreds,colored), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavoreds,colored), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavored,coloreds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavored,coloreds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavoreds,coloreds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Ice,flavoreds,coloreds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shopping,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shopping,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shoppings,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shoppings,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shopping,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shopping,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shoppings,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shoppings,meat), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shopping,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shopping,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shoppings,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shoppings,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shopping,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shopping,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internet,shoppings,meats), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((internets,shoppings,meats), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((juice,bar), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((juices,bar), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((juice,bars), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((juices,bars), 6)')) 
/* 750 rows of same kind of full text search*/
OR( CONTAINS(Casefilestatementstext,'NEAR((Tacoes,shell), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Taco,shells), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Tacoes,shells), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Top,tank), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Tops,tank), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Top,tanks), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Tops,tanks), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((travel,agency), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((travels,agency), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((travel,agencies), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((travels,agencies), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Vegetable,dried), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Vegetables,dried), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Vegetable,drieds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Vegetables,drieds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Waffle,mix), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Waffles,mix), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Waffle,mixes), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Waffles,mixes), 6)'))
  )
Order by Registrationno desc, SerialNo desc 


Вот ответ на запрос:
2017-08-29_1505[^]

Как я могу получить быстрый результат с помощью оптимизации запроса или изменения структуры таблицы?

Что я уже пробовал:

Я создал уникальный ключ для столбца SerialNo и некластеризованный индекс для столбца Registrationno.

Я боюсь, что слишком большое количество индексов снизит производительность запросов.

2 Ответов

Рейтинг:
2

Jochen Arndt

Есть некоторая избыточность:

OR(Casefilestatementstext like '%Apron%') 
OR(Casefilestatementstext like '%Aprons%')
Первое утверждение совпадает и со следующим. Таким образом, нет необходимости проверять наличие "фартуков" и подобных им для всех других проверок в этом блоке.

Я знаю, что это не сильно ускорит процесс, но это уже улучшение.

[РЕДАКТИРОВАТЬ]
Есть также несколько дубликатов. Пример:
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patty), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patty), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patties), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,patties), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minced), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minced), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minceds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,minceds), 6)')) 
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processed), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processeds), 6)'))
OR( CONTAINS(Casefilestatementstext,'NEAR((Beef,processeds), 6)')) 
[/РЕДАКТИРОВАТЬ]


Рейтинг:
0

Tom Wauters

Для этого может быть небольшой обходной путь. Прежде всего потеряйте дубликаты, как сказал Йохен. Если у вас есть доступ к структуре БД, вы можете создать новую таблицу с идентификатором таблицы товарных знаков и флагом строки поиска, которая у нее есть. Значение: говядина =1, куртка =2,...
Группировка по 2 должна идти быстрее, чем полнотекстовый поиск. С помощью идентификаторов, которые вы получаете, вы можете получить строки в таблице товарных знаков. Однако это приводит к некоторым накладным расходам, поскольку вам всегда приходится обновлять новую таблицу при изменениях в таблице товарных знаков.
Как я и сказал. Это обходной путь, и он не собирается исправлять медленный запрос.