Skip to content

Commit 7f7c068

Browse files
committed
MOSIP-43917 | added missed index script
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
1 parent aa1e44c commit 7f7c068

8 files changed

Lines changed: 19 additions & 3 deletions

db_scripts/mosip_ida/ddl/ida-auth_transaction.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ CREATE INDEX idx_autntxn_token_crdtimes_desc
6363
ON ida.auth_transaction (token_id, cr_dtimes DESC);
6464
CREATE INDEX idx_autntxn_token_reqdtimes
6565
ON ida.auth_transaction (token_id, request_dtimes);
66+
CREATE INDEX IF NOT EXISTS idx_auth_txn_entityid_request_dtimes_cover ON ida.auth_transaction USING btree (requested_entity_id, request_dtimes) INCLUDE (id);
6667

6768
ALTER TABLE ida.auth_transaction SET (
6869
autovacuum_vacuum_scale_factor = 0.002,

db_scripts/mosip_ida/ddl/ida-batch_job_execution.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ ALTER TABLE batch_job_execution SET (
2626
autovacuum_vacuum_threshold = 1000,
2727
autovacuum_analyze_scale_factor = 0.05,
2828
autovacuum_analyze_threshold = 1000
29-
);
29+
);
30+
31+
--PERFORMANCE INDEXES
32+
CREATE INDEX IF NOT EXISTS idx_job_exec_instance ON ida.batch_job_execution USING btree (job_instance_id);

db_scripts/mosip_ida/ddl/ida-batch_step_execution.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@ ALTER TABLE batch_step_execution SET (
3535
autovacuum_vacuum_threshold = 2000,
3636
autovacuum_analyze_scale_factor = 0.05,
3737
autovacuum_analyze_threshold = 2000
38-
);
38+
);
39+
40+
41+
CREATE INDEX IF NOT EXISTS idx_step_exec_jobid_stepname ON ida.batch_step_execution USING btree (job_execution_id, step_name);

db_scripts/mosip_ida/ddl/ida-data_encrypt_keystore.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ COMMENT ON COLUMN ida.data_encrypt_keystore.cr_dtimes IS 'Created DateTimestamp
4848
COMMENT ON COLUMN ida.data_encrypt_keystore.upd_by IS 'Updated By : ID or name of the user who update the record with new values';
4949
-- ddl-end --
5050
COMMENT ON COLUMN ida.data_encrypt_keystore.upd_dtimes IS 'Updated DateTimestamp : Date and Timestamp when any of the fields in the record is updated with new values.';
51-
-- ddl-end --
51+
-- ddl-end --
52+
53+
--PERFORMANCE INDEXES
54+
CREATE INDEX IF NOT EXISTS encrypt_id ON ida.data_encrypt_keystore USING btree (id);

db_scripts/mosip_ida/ddl/ida-hotlist_cache.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ON ida.hotlist_cache (id_hash, id_type);
1414
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_hotlist_active
1515
ON ida.hotlist_cache (id_hash, id_type, status)
1616
WHERE status = 'Blocked';
17+
CREATE INDEX IF NOT EXISTS idx_hotlistcache_hash_type ON ida.hotlist_cache USING btree (id_hash, id_type);
1718

1819
-- Optimize autovacuum for hotlist_cache to clean dead tuples
1920
ALTER TABLE hotlist_cache SET (

db_scripts/mosip_ida/ddl/ida-identity_cache.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CREATE TABLE ida.identity_cache(
3232
-- ddl-end --
3333
--index section starts----
3434
CREATE INDEX ind_id ON ida.identity_cache (id);
35+
CREATE INDEX IF NOT EXISTS idx_identity_cache_cr_dtimes ON ida.identity_cache USING btree (cr_dtimes);
3536
--index section ends------
3637

3738
ALTER TABLE identity_cache SET (

db_scripts/mosip_ida/ddl/ida-otp_transaction.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ CREATE INDEX ind_refid ON ida.otp_transaction (ref_id,status_code);
3636

3737
CREATE INDEX idx_otp_txn_ref_status_gen
3838
ON ida.otp_transaction (ref_id, status_code, generated_dtimes DESC);
39+
CREATE INDEX IF NOT EXISTS idx_is_deleted ON ida.otp_transaction USING btree (is_deleted);
40+
CREATE INDEX IF NOT EXISTS idx_refid_generated ON ida.otp_transaction USING btree (ref_id, generated_dtimes);
3941

4042
-- Optimize autovacuum for otp_transaction to clean dead tuples
4143
ALTER TABLE otp_transaction SET (

db_scripts/mosip_ida/ddl/ida-uin_auth_lock.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ CREATE TABLE ida.uin_auth_lock(
3333
-- ddl-end --
3434
--index section starts----
3535
CREATE INDEX ind_ual_id ON ida.uin_auth_lock (token_id);
36+
CREATE INDEX IF NOT EXISTS idx_ual_token_auth_crd ON ida.uin_auth_lock USING btree (token_id, auth_type_code, cr_dtimes DESC)
37+
CREATE INDEX IF NOT EXISTS idx_uin_auth_lock_token_auth_crd_desc ON ida.uin_auth_lock USING btree (token_id, auth_type_code, cr_dtimes DESC) INCLUDE (status_code, unlock_expiry_datetime);
3638
--index section ends------
3739

3840
ALTER TABLE uin_auth_lock SET (

0 commit comments

Comments
 (0)