if exists(select* from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_ROUTE_TO_DIAGNOSTICS', 'U') and i.name = 'IX_T_ROUTE_TO_DIAGNOSTICS_Number')
	drop index [IX_T_ROUTE_TO_DIAGNOSTICS_Number] on AKUZ.[T_ROUTE_TO_DIAGNOSTICS];
go
CREATE INDEX [IX_T_ROUTE_TO_DIAGNOSTICS_Number] ON [AKUZ].[T_ROUTE_TO_DIAGNOSTICS] ( [Number] ) INCLUDE ([Research]) WITH (FILLFACTOR=100, SORT_IN_TEMPDB=ON);
GO
if exists(select* from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_RTV_LINK_VG', 'U') and i.name = 'IX_RTV_LINK_VG_RouteToVaccination_Includes')
	drop index IX_RTV_LINK_VG_RouteToVaccination_Includes on AKUZ.T_RTV_LINK_VG;
go
CREATE INDEX [IX_RTV_LINK_VG_RouteToVaccination_Includes] ON [AKUZ].[T_RTV_LINK_VG] ([RouteToVaccination])  INCLUDE ([VaccineLibrary]) WITH (MAXDOP = 0, SORT_IN_TEMPDB=ON);
GO

if exists ( select * from sys.indexes i where i.object_id = object_id('AKUZ.T_VISIT', 'U') and i.name = 'IX_VISIT_OutcomeRecord_Post_Includes')
		DROP INDEX IX_VISIT_OutcomeRecord_Post_Includes ON [AKUZ].[T_VISIT];
go
CREATE INDEX [IX_VISIT_OutcomeRecord_Post_Includes] ON [AKUZ].[T_VISIT] ([OutcomeRecord], [Post]) INCLUDE ([VisitDate],[type_],[AmbulanceEvent])  WITH (FILLFACTOR=100, SORT_IN_TEMPDB=ON);
GO

if exists ( select * from sys.indexes i where i.object_id = object_id('AKUZ.T_VISIT', 'U') and i.name = 'IX_VISIT_OutcomeRecord')
		DROP INDEX IX_VISIT_OutcomeRecord ON [AKUZ].[T_VISIT];
go