Add index on product 'active' column, and also on product_id in product_categories table.