playSMS Forum

Mysql slow query

I have some slow-query in mysql log.
I tune mysql with mysqltuner.

Sent message and Billing calculate are very very slow. ( I keep onlu 9 days msg, and old msg will be delete )

here mysql slow log :

# Query_time: 0.000906  Lock_time: 0.000094  Rows_sent: 1  Rows_examined: 622
SET timestamp=1598120791;
SELECT SUM(amount) AS credit FROM playsms_featureCredit WHERE uid='33' AND flag_deleted='0';
# User@Host: admin[admin] @ localhost []
# Thread_id: 172  Schema: playsms  QC_hit: No
# Query_time: 0.176466  Lock_time: 0.000104  Rows_sent: 0  Rows_examined: 62766
SET timestamp=1598120791;
SELECT SUM(A.charge) AS billing FROM playsms_tblBilling A INNER JOIN playsms_tblSMSOutgoing B ON A.smslog_id=B.smslog_id AND A.status='1' AND B.uid='33';