In my production database performance issue.
My sql query is taking long time for executing so the how to optimize the following mysql query.
select sum(distributor_earning) as col_0_0_, sum(distributor_share) as col_1_0_
from my_transaction mytransac0_
cross join del_transaction deltran1_
cross join user user3_
where mytransac0_.del_transaction_id=deltran1_.id and deltran1_.agent_parent_id=user3_.id and deltran1_.trx_status=4 and user3_.username='xyz';
It gives following output
+-----------+-----------+
| col_0_0_ | col_1_0_ |
+-----------+-----------+
| 579239.27 | 630557.77 |
+-----------+-----------+
1 row in set (15.14 sec)
I have over 100k records.
IN where condition index is build in del_transaction_id