In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `user_org_xref` ADD INDEX `user_xref_idx_user_id_organization_id` (`USER_ID`,`ORGANIZATION_ID`);
ALTER TABLE `user_tbl` ADD INDEX `user_tbl_idx_acct_id_user_type` (`ACCT_STATUS_ID`,`user_type`);
SELECT
count(*) AS col_0_0_,
usertb0_.ACCT_STATUS_ID AS col_1_0_,
usertb0_.user_type AS col_2_0_
FROM
user_tbl usertb0_
INNER JOIN
user_org_xref userorgxre1_
ON usertb0_.USER_ID = userorgxre1_.USER_ID
WHERE
(
userorgxre1_.ORGANIZATION_ID IN (
2
)
)
AND (
usertb0_.ACCT_STATUS_ID IN (
1, 11, 13, 15, 2
)
)
GROUP BY
usertb0_.ACCT_STATUS_ID,
usertb0_.user_type
ORDER BY
NULL