Index: openacs-4/packages/bulk-mail/bulk-mail.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/bulk-mail.info,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/bulk-mail/bulk-mail.info 29 Mar 2018 23:07:34 -0000 1.18 +++ openacs-4/packages/bulk-mail/bulk-mail.info 11 Dec 2018 10:38:04 -0000 1.19 @@ -7,7 +7,7 @@ f f - + OpenACS 2017-08-06 DotLRN Consortium @@ -16,7 +16,7 @@ Provides an API for sending messages to a collection of users (which can be chosen via arbitrary sql). Mails can be personalized and can be scheduled for a later date. - + Index: openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql 8 Aug 2006 21:26:15 -0000 1.3 +++ openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql 11 Dec 2018 10:38:04 -0000 1.4 @@ -37,6 +37,7 @@ constraint bm_messages_status_nn not null ); +CREATE INDEX bm_messages_status_idx ON bulk_mail_messages(status); -- create a new object type begin Index: openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-2.10.0d0-2.10.0d1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-2.10.0d0-2.10.0d1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-2.10.0d0-2.10.0d1.sql 11 Dec 2018 10:38:05 -0000 1.1 @@ -0,0 +1,4 @@ +--- +--- reduce sequential reads by sweeper +--- +CREATE INDEX bm_messages_status_idx ON bulk_mail_messages(status); Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql 27 Oct 2014 16:41:06 -0000 1.5 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql 11 Dec 2018 10:38:05 -0000 1.6 @@ -42,9 +42,10 @@ check (status in ('pending', 'cancelled', 'sent')) constraint bm_messages_status_nn not null - ); +CREATE INDEX bm_messages_status_idx ON bulk_mail_messages(status); + -- create a new object type CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$ BEGIN Index: openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-2.10.0d0-2.10.0d1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-2.10.0d0-2.10.0d1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-2.10.0d0-2.10.0d1.sql 11 Dec 2018 10:38:05 -0000 1.1 @@ -0,0 +1,24 @@ +--- +--- reduce sequential reads by sweeper +--- + +DO $$ +DECLARE + v_found boolean; +BEGIN + -- + -- Was the index already created? + -- + -- In versions of PostgreSQL starting with 9.5, we could use + -- "CREATE INDEX ... IF NOT EXISTS ..." + + SELECT exists( + SELECT relname from pg_class + WHERE relname ='bm_messages_status_idx' + ) into v_found; + + if v_found IS FALSE then + CREATE INDEX bm_messages_status_idx ON bulk_mail_messages(status); + end if; + +END$$;