8545e05fc0aaad1c942317f6b4ac120da415b3cc
The query was computing the count for all mailing lists, not just the one being requested. This prevents optimizing the SELECT with indexes. In addition, using a subselect for the blacklist forced a full table scan on the contacts - switching to a LEFT JOIN avoids that. With a blacklist of a few hundred thousand entries, and a table of mailing list contacts in the same order of magnitude, this brings the SELECT from 3+ seconds down to 3 milliseconds - with the same result. Bonus: no need to perform the regexp extraction of emails to test for NULL values -> substring(x) is NULL iff x is NULL.
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
Then follow the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%