← Back to team overview

dhis2-devs team mailing list archive

Re: /api/analytics call taking 45 seconds to respond

 

Hi Lars ,

       I see that all the indicators are present in the analytics tables.

      The following are the tomcat logs generated ,
================

* INFO  2014-08-13 10:28:08,256 Time: 224116 micros: Planned query, got: 2
for optimal: 2 (Timer.java [http-bio-8080-exec-240])
* INFO  2014-08-13 10:28:08,270 Time: 9003 micros: Analytics SQL: select
"de","weekly","co", sum(value) as value from analytics_2014 where "de" in
('a950d8cfb79', 'a808c717907', 'af74bfc4f4b', 'a83c9562695', 'acd2953e5c5',
'ad8782f65f0', 'a99f37dad3b', 'a8f9b796666', 'a2de9b3c152', 'a0c015f0563',
'a955fe3d8ef', 'a2bd3e2c06d', 'aaab5cb25eb', 'aba9dfe1ee2', 'a4cf6868069',
'a0ed20a21eb', 'ac9a5d2bb02', 'a8e335924e4', 'a0a1bec6b2f', 'a91553637f2',
'a15bbdd2fb9', 'ac9c8510ef0', 'a9405e11f51', 'a8bd6519122', 'a277a18dcf2',
'a3d9ce5c1b8', 'a8d73f87c51', 'acd21828c8f', 'a6bfceeee6b', 'afbd4276a23',
'a3edec55bf1', 'aaa5270f9e1', 'ac657e72d5b') and "weekly" in ('2014W32')
and ( "uidlevel4" in ('a8707b4af7a') ) group by "de","weekly","co"
(Timer.java [SimpleAsyncTaskExecutor-124])
* INFO  2014-08-13 10:28:08,275 Time: 14591 micros: Analytics SQL: select
"de","weekly","co", sum(value) as value from analytics_2014 where "de" in
('a8302bced83', 'ae907341ae6', 'aeca4e01adc', 'af6e765e74b', 'a95661b1594',
'a736d5b0833', 'ab958bbda7e', 'af7ee417c57', 'a6fe9a2bb8a', 'a93eaf35a63',
'a3b1f053524', 'a228d86451f', 'a033ad65279', 'a43840c33c6', 'ad6d26f7cd2',
'ac55aca5226', 'a6a52c830d3', 'a10c0cbab04', 'ae4074c66b7', 'ac068e710d9',
'a84ad635988', 'a337fc2f2b8', 'adc435d089d', 'a19d061a2d6', 'af7f29f0bb3',
'aedcbfce43d', 'ab52a090760', 'a9f675dd5c0', 'a5f3c4bd616', 'a8bb2763d17',
'a016660ace5', 'ab1dc2f3c50', 'a87d2715668') and "weekly" in ('2014W32')
and ( "uidlevel4" in ('a8707b4af7a') ) group by "de","weekly","co"
(Timer.java [SimpleAsyncTaskExecutor-123])
* INFO  2014-08-13 10:28:08,276 Time: 243767 micros: Got aggregated values
for query group (Timer.java [http-bio-8080-exec-240])
* INFO  2014-08-13 10:28:08,277 Time: 244934 micros: Got aggregated values
(Timer.java [http-bio-8080-exec-240])

================

 The api call we make is as follows ,

 /api/analytics?dimension=dx:a58dcf8ecbb;ab942541879;ad0c678f1e9;a6f44336370;a0ec4d217b1;ab181681be4;a8c456244e4;a4d946086aa;a93318080d4;abefdaa6095;ad5e0d12434;a70e54b898a;a6f7f86df4f;a7a43864050;ac0e862dae7;a251a45dcc1;ac7a45caa43;a80290bf587;abd7e20e0d8;a456638282f;a6c3ae2279b;ada20ae0907;a5e4ff57110;adbe178f6e7;a0b7b1fa8cc;abb22e1762e;a84b8295c97;ac9c458e53b;a52372c8689;a6bb96fa095;ae1a219791b;aaf0fbdbbaa;a571983042a;a470df6805f;a9fb96b85d8;a723416284e;aa5e9b4a578;abe06abfa88;a795cdae88a;a95c5ba0d37;ab754f8a748;ad065d87687;a5d311597a4;a6f86d679af;a0d57213750;a9be29c4bc6;a6dae7446cd;a2570b40df9;adf3a2928af;a9a35b32bb8;a74efe10bba;acfa49c57b6;af884e3e74a;a857a0149da;ae3c54a0d68;a81c94fa860;a41f3351ef1;ab4d8d2349e;aec5f860aa8;aded784e1d9;a6fcec32e3e;a1dab83c245;a3dbafeb0b3;a0ab3ee581f;afebf10227d;a9596797907&dimension=pe:2014W32&filter=ou:a8707b4af7a



On Tue, Aug 12, 2014 at 3:56 PM, Lars Helge Øverland <larshelge@xxxxxxxxx>
wrote:

> HI Sandesh,
>
> can you check that all indexes are present on the analytics tables? The
> number of indexes per table should be (no of cols - 3).
>
> Please also post the SQL queries generated by analytics, you can find them
> in the tomcat logs.
>
> regards,
>
> Lars
>
>
>
> On Tue, Aug 12, 2014 at 12:14 PM, Sandesh Sukumar Doolipeta <
> sandeshd@xxxxxxxxxxxxxxxx> wrote:
>
>> Hi ,
>>
>> One chart in our custom DHIS app requires us to display the top 5
>> indicators for a specified data set section. These indicators are
>> calculated as [data element value] / [sum of all data element values in the
>> data set section]. We are using the /api/analytics to fetch all indicator
>> values from dhis after which we are filtering out the top 5 values in our
>> app to display it to the user
>>
>> One of our data set sections has a little over 60 data elements and
>> loading this chart is taking about 45 secs.
>>
>> Is there any optimization we can do to make this call respond faster
>>
>>
>> Regards
>> Sandesh , SimiJ
>>
>
>


-- 
*Sandesh Doolipeta**Application Developer*
Emailsandeshd@xxxxxxxxxxxxxxxx
Telephone9686062727
[image: ThoughtWorks] <http://www.thoughtworks.com/>

References