123 lines
3.6 KiB
PL/PgSQL
123 lines
3.6 KiB
PL/PgSQL
/*
|
|
Missing Index Details from SQLQuery61.sql - swamarepprd01.centralinfra.net.ArizonaREP (CENTRALINFRA\ua208700 (142))
|
|
The Query Processor estimates that implementing the following index could improve the query cost by 22.4378%.
|
|
*/
|
|
|
|
|
|
USE [ArizonaREP]
|
|
GO
|
|
|
|
return
|
|
--EXEC sp_rename 'dbo.Address_update_history.NCIX_Addressupdatehistory_COL_AUHtargetupdatedate'
|
|
--,'NCIX_Addressupdatehistory_COL_AUHtargetupdatedate_old'
|
|
--,'index'
|
|
|
|
|
|
--CREATE NONCLUSTERED INDEX [NCIX_Addressupdatehistory_COL_AUHtargetupdatedate]
|
|
--ON [dbo].[Address_update_history] ([AUH_target_OU],[AUH_target_update_date])
|
|
--INCLUDE ([AUH_address],[AUH_update_date])
|
|
--GO
|
|
|
|
---- NCIX_Addressupdatehistory_COL_AUHtargetupdatedate_old
|
|
--IF INDEXPROPERTY(OBJECT_ID('dbo.Address_update_history'), 'NCIX_Addressupdatehistory_COL_AUHtargetupdatedate_old' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
-- DROP INDEX dbo.Address_update_history.NCIX_Addressupdatehistory_COL_AUHtargetupdatedate_old;
|
|
--END;
|
|
--GO
|
|
|
|
|
|
|
|
|
|
---- NCIX_Address_COL_ADtopmasteraddress
|
|
--EXEC sp_rename 'dbo.Address.NCIX_Address_COL_ADtopmasteraddress','NCIX_Address_COL_ADtopmasteraddress_to_del','index'
|
|
|
|
--IF INDEXPROPERTY(OBJECT_ID('dbo.Address'), 'NCIX_Address_COL_ADtopmasteraddress' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
-- DROP INDEX dbo.Address.NCIX_Address_COL_ADtopmasteraddress;
|
|
--END;
|
|
--GO
|
|
--IF INDEXPROPERTY(OBJECT_ID('dbo.Address'), 'NCIX_Address_COL_ADtopmasteraddress' , 'IndexID' ) IS NULL BEGIN;
|
|
-- CREATE INDEX NCIX_Address_COL_ADtopmasteraddress ON dbo.Address(AD_top_master_address)
|
|
-- INCLUDE([Address_GUID], [AD_master_address]);
|
|
--END;
|
|
--GO
|
|
|
|
--IF INDEXPROPERTY(OBJECT_ID('dbo.Address'), 'NCIX_Address_COL_ADtopmasteraddress_to_del' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
-- DROP INDEX dbo.Address.NCIX_Address_COL_ADtopmasteraddress_to_del;
|
|
--END;
|
|
--GO
|
|
|
|
|
|
|
|
---- NCIX_Telecom_COL_TELType
|
|
--IF INDEXPROPERTY(OBJECT_ID('dbo.Telecom'), 'NCIX_Telecom_COL_TELType' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
-- DROP INDEX dbo.Telecom.NCIX_Telecom_COL_TELType;
|
|
--END;
|
|
--GO
|
|
--IF INDEXPROPERTY(OBJECT_ID('dbo.Telecom'), 'NCIX_Telecom_COL_TELType' , 'IndexID' ) IS NULL BEGIN;
|
|
-- CREATE NONCLUSTERED INDEX NCIX_Telecom_COL_TELType
|
|
-- ON [dbo].[Telecom] ([TEL_type])
|
|
-- INCLUDE ([Telecom_GUID],[TEL_address])
|
|
--END;
|
|
--GO
|
|
|
|
|
|
|
|
CREATE NONCLUSTERED INDEX [NCFIX_Address_COL_Status1_MasterAddressNull]
|
|
ON [dbo].[Address] ([AD_last_name])
|
|
INCLUDE (
|
|
[AD_activity],
|
|
[AD_APS_TS],
|
|
[AD_area],
|
|
[AD_can_be_subsidiary_updated],
|
|
[AD_communication_channel],
|
|
[AD_CUST_blocking],
|
|
[AD_CUST_remark],
|
|
[AD_customer_category_code],
|
|
[AD_customer_group_code],
|
|
[AD_employee],
|
|
[AD_mailing_language_code],
|
|
[AD_main_insurance_key],
|
|
[AD_main_insurance_name],
|
|
[AD_main_insurance_policy],
|
|
[AD_merge_date],
|
|
[AD_middle_name],
|
|
[AD_name_supplement],
|
|
[AD_OmniChannelUId],
|
|
[AD_Omnichannel_UUID],
|
|
[AD_remark],
|
|
[AD_salutation_text],
|
|
[AD_social_security_number],
|
|
[AD_supplier],
|
|
[AD_title_text],
|
|
[AD_top_master_address],
|
|
[AD_user_login],
|
|
[AD_address_1],
|
|
[AD_address_2],
|
|
[AD_address_3],
|
|
[AD_advertising],
|
|
[AD_birth_year],
|
|
[AD_city],
|
|
[AD_country_code],
|
|
[AD_country_text],
|
|
[AD_creation_OU],
|
|
[AD_CUST_remark_pharma],
|
|
[AD_customer],
|
|
[AD_date_of_birth],
|
|
[AD_first_name],
|
|
[AD_PH_height],
|
|
[AD_language_code],
|
|
[AD_mailing],
|
|
[AD_main_insurance_GUID],
|
|
[AD_memo],
|
|
[AD_name],
|
|
[AD_origin],
|
|
[AD_postal_routing_address],
|
|
[AD_sex],
|
|
[AD_title_code],
|
|
[AD_update_date],
|
|
[AD_update_OU],
|
|
[AD_PH_weight],
|
|
[AD_zip_code]
|
|
)
|
|
WHERE [AD_status] = 1
|
|
AND [AD_master_address] IS NULL
|
|
WITH(FILLFACTOR=70); |