Currently UPS gets the metrics about a given application with the following query:
select count(*), sum(total_receivers), sum(app_open_counter) from push_message_info where push_application_id = 'a333dafc-f74d-4d1b-83dc-a2fb973338f8';
|
This happens to need about 2 minutes to execute when we have millions of rows for a single app. A solution to this could be to create another table:
push_message_metrics(push_application_id VARCHAR(255) PRIMARY KEY, total_receivers BIGINT(20), total_app_open BIGINT(20));
|
And then keep it up to date with a trigger after insert on the push_application_id table. |