Home > Net >  Count subqueries too slow SQL?
Count subqueries too slow SQL?

Time:12-29

I have to make a table that includes many different counts across different tables.. These tables can be joined but an issue I found was that when joining them together is that it becomes a very large table that takes awhile to load. The below query takes around 30 seconds to load, does anyone know how I could make this faster?

SELECT  companies_company.id as company_id, companies_company.name as company_name, companies_company.office_location, companies_company.company_type,
(select count(*) from auth_user u where u.company_id = companies_company.id and (u.is_staff = 'false' or u.is_parent_company_admin ='false' or u.is_superuser = 'false') and u.email not ilike '           
  • Related