71 lines
2.1 KiB
PL/PgSQL
71 lines
2.1 KiB
PL/PgSQL
/*=============================================================================
|
|
|
|
OCTPDBA-565
|
|
Manage indexes followig 23.2 release branch
|
|
|
|
Parameters
|
|
----------------------
|
|
|
|
|
|
Context
|
|
----------------------
|
|
Every pharmacies
|
|
|
|
Creation : 21.04.2023 / TSC
|
|
Modifications:
|
|
|
|
=============================================================================*/
|
|
USE [Arizona]
|
|
GO
|
|
|
|
/*
|
|
Item_criteria
|
|
drop old constraints. 2 can be merged and 1 is not used
|
|
|
|
XIEAPS2Item_criteria = dbo.Item_criteria(ITCR_master_ID) ==> to drop, not used
|
|
XIF1039Item_criteria = dbo.Item_criteria(ITCR_item) ==> becomes an include on the index on ITCR_criteria
|
|
XIF1041Item_criteria = dbo.Item_criteria(ITCR_criteria)
|
|
*/
|
|
IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'XIEAPS2Item_criteria' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
DROP INDEX dbo.Item_criteria.XIEAPS2Item_criteria;
|
|
END;
|
|
GO
|
|
|
|
IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'XIF1039Item_criteria' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
DROP INDEX dbo.Item_criteria.XIF1039Item_criteria;
|
|
END;
|
|
GO
|
|
|
|
IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'XIF1041Item_criteria' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
DROP INDEX dbo.Item_criteria.XIF1041Item_criteria;
|
|
END;
|
|
GO
|
|
|
|
|
|
IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'NCIX_Item_criteria_COL_ITCR_criteria' , 'IndexID' ) IS NULL BEGIN;
|
|
CREATE NONCLUSTERED INDEX NCIX_Item_criteria_COL_ITCR_criteria ON dbo.Item_criteria(ITCR_criteria)
|
|
INCLUDE(ITCR_item);
|
|
END;
|
|
GO
|
|
|
|
|
|
/* ------------------------------------------------------ */
|
|
|
|
/*
|
|
Document_line
|
|
|
|
the index NCIX_Document_line_COL_DL_type is not used.
|
|
Adapt it to follow the recommendation
|
|
*/
|
|
|
|
-- NCIX_Document_line_COL_DL_type
|
|
IF INDEXPROPERTY(OBJECT_ID('dbo.Document_line'), 'NCIX_Document_line_COL_DL_type' , 'IndexID' ) IS NOT NULL BEGIN;
|
|
DROP INDEX [dbo].[Document_line].[NCIX_Document_line_COL_DL_type];
|
|
END;
|
|
GO
|
|
IF INDEXPROPERTY(OBJECT_ID('dbo.Document_line'), 'NCIX_Document_line_COL_DL_type' , 'IndexID' ) IS NULL BEGIN;
|
|
CREATE INDEX [NCIX_Document_line_COL_DL_type] ON [dbo].[Document_line]([DL_type], [DL_to_be_invoiced])
|
|
INCLUDE([DL_document_header]);
|
|
END;
|
|
GO
|