I wanted to create two index on my table having 500 million rows, Since index creation will take some time to finish, I am thinking to run two indexes statement parallelly, But I don't know how, I want to use procedure to create the Index, Here is my function:
CREATE OR REPLACE PROCEDURE test() LANGUAGE plpgsql AS $PROCEDURE$
BEGIN
SET statement_timeout = 7200000;
COMMIT;
CREATE INDEX IF NOT EXISTS idx_tt1_org_id ON temp_table_1(org_id);
CREATE INDEX IF NOT EXISTS idx_tt1_input_id ON temp_table_1(input_id);
END;$PROCEDURE$;
Please help me how to run these index statement in parallel. Thanks
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_tt1_org_id ON temp_table_1(org_id);