Index on mailing_account_tbl

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

chollois
Posts: 7
Joined: Fri Sep 18, 2015 2:00 pm

Index on mailing_account_tbl

Post by chollois »

Hello

we found that the table mailing_account_tbl should be indexed, since it's a big table.
If not and having a very big number of mailings, the console never answers, since the SQL request in openemm 2013 for mailing overview seems to be something like :

SELECT *,
case when senddate is null then 0 else 1 end as send_null
FROM (
SELECT a.mailing_id , a.shortname , a.description ,
min(c.change_date ) senddate,
m.shortname mailinglist
FROM (mailing_tbl a LEFT JOIN mailing_account_tbl c ON (a.mailing_id=c.mailing_id AND c.status_field='W'))
LEFT JOIN mailinglist_tbl m ON ( a.mailinglist_id=m.mailinglist_id AND a.company_id=m.company_id)
WHERE a.company_id = 1 AND a.deleted<>1 AND a.is_template=0
GROUP BY a.mailing_id, a.shortname, a.description, m.shortname ) openemm
ORDER BY send_null ASC, senddate DESC, mailing_id DESC;
jlesaux
Posts: 8
Joined: Wed Aug 27, 2014 4:25 pm

Re: Index on mailing_account_tbl

Post by jlesaux »

Hi,

Maybe you can test that :

Code: Select all

CREATE INDEX mailing_account_tbl_idx ON mailing_account_tbl (mailing_id, status_field);
Should works on your issue.

Best regards,

--
Julien LE SAUX
chollois
Posts: 7
Joined: Fri Sep 18, 2015 2:00 pm

Re: Index on mailing_account_tbl

Post by chollois »

Perfect, thank you
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Index on mailing_account_tbl

Post by maschoff »

Thanks for sharing, I will add this tip to the next release of the OpenEMM Install&Admin Guide.
OpenEMM Maintainer
jlesaux
Posts: 8
Joined: Wed Aug 27, 2014 4:25 pm

Re: Index on mailing_account_tbl

Post by jlesaux »

Hi,

OK cool !

You may want to add this one too :

Code: Select all

CREATE INDEX mailing_id_index ON component_tbl (mailing_id);
Best regards,

--
Julien LE SAUX
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Index on mailing_account_tbl

Post by maschoff »

Will do, thanks!
OpenEMM Maintainer
Post Reply