Strange and too long sql query to statistic table

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Strange and too long sql query to statistic table


XWiki version 7.1.2. We use Tomcat and MySQL. In query statistic we see many long queries such as below:

# Query_time: 49.708503  Lock_time: 0.000089 Rows_sent: 0  Rows_examined: 4979
SET timestamp=1477308512;
select visitstats0_.XWV_ID as XWV1_22_, visitstats0_.XWV_NUMBER as XWV2_22_, visitstats0_.XWV_NAME as XWV3_22_, visitstats0_.XWV_CLASSNAME as XWV4_22_,
visitstats0_.XWV_IP as XWV5_22_, visitstats0_.XWV_USER_AGENT as XWV6_22_, visitstats0_.XWV_COOKIE as XWV7_22_, visitstats0_.XWV_UNIQUE_ID as XWV8_22_,
visitstats0_.XWV_PAGE_VIEWS as XWV9_22_, visitstats0_.XWV_PAGE_SAVES as XWV10_22_, visitstats0_.XWV_DOWNLOADS as XWV11_22_, visitstats0_.XWV_START_DAT
E as XWV12_22_, visitstats0_.XWV_END_DATE as XWV13_22_ from xwikistatsvisit visitstats0_ where visitstats0_.XWV_UNIQUE_ID=' (com
patible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)' and visi
tstats0_.XWV_END_DATE>'2016-10-24 13:57:42' order by visitstats0_.XWV_END_DATE desc;

If I understand correctly these queries check if the user entered the last 30 minutes. But why ? And why so long query time ? I try to reproduce in mysql console (do select for my unique id for last 30 minutes) and query so fast (~0,1s)