Thanks for your reply!

Yes, if the query execute like the sql in mysql, sql with COUNT() will 
ignore the LIMIT clause. But in influx 13.0, the COUNT result seems related 
to LIMIT clause and date. 
I make an test to varify my guess.
Firstly, i insert 2000 points with default timestamp to measurement, and 
execute "select COUNT(XX) from xx limit 10", it returns 11. Secondly, after 
one day later, i repeat the first step again. At this time, it returns 
22. Thirdly, repeat the first step one more time, it still returns 22. 
Fourthly, i leave the LIMIT clause off, it returns 6000, the total number 
of points i inserted into it.

Here is screenshots about step three and four.

<https://lh3.googleusercontent.com/-oMypeFFB6BA/V47gRYOg10I/AAAAAAAAABQ/IyMOJ2azb0UI-KLl6fd0xS2Ld_AZ0YANACLcB/s1600/55.png>

<https://lh3.googleusercontent.com/-sZpTg8UudhU/V47gXZF8VnI/AAAAAAAAABU/mlzb8695f5kVf0mNH7EvdhZ2Qes8GfThACLcB/s1600/66.png>



And, here is my java code to test it.

    InfluxDB influxdb = InfluxDBFactory.connect("http://x.x.x.x:8086";, 
"root", "root");
    for(int k=0;k<100;k++){
      for(int i=0;i<5;i++){
        for(int j=0;j<4;j++){
          Map<String,String> tag = new HashMap<String,String>();
          Map<String,Object> fields = new HashMap<String,Object>();
          tag.put("host", "host"+j);
          tag.put("queue", "test"+i);
          
          fields.put("ready", i+1+k);
          fields.put("unacked", i+2+k);
          fields.put("counsumers", 0);
          Point p = 
Point.measurement("test").tag(tag).fields(fields).build();
          BatchPoints bp = 
BatchPoints.database("tt").retentionPolicy("rp_30d").point(p).build();
          
          influxdb.write(bp);
        }
      }
    }







在 2016年7月20日星期三 UTC+8上午3:35:28,Sean Beckett写道:
>
> LIMIT limits the number of values returned, not the number of points 
> sampled. With an aggregation function like COUNT(), there is only one value 
> returned for all the points sampled. LIMIT 10 has no meaning since there's 
> only one result to return. You will get the same output if you leave the 
> LIMIT clause off.
>
> So, you have 11 points with an "unacked" field, and then over time more 
> points match and the number rises.
>
> On Mon, Jul 18, 2016 at 8:32 PM, <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>   I'm new to Influxdb, and using 13.0.
>>   I create a database with 30d duration, 1d shardGroupDuration, 1 
>> replicat and one measurement. The measurement has 4 tags(machinename, 
>> queue_type, vhost, queuename) and 5 values(consumers, ready, unacked, 
>> enqueued, dequeued). 
>>   First i query "select * from mqMetric where queue_type = 'ACTIVEMQ' 
>> limit 10", and get 10rows. Then, query "select count(unacked) from mqMetric 
>> where queue_type = 'ACTIVEMQ' limit 10", it return different values. At the 
>> beginning, it returns 11. Then, writing data for about 4 days, it returns 
>>  44. As there are some data with different tags in the measurement, so i 
>> wonder if this make the problem, and i drop the measurement, restart 
>> writing data to it. Again, It returns 11 at the beginning, and one day 
>> later, it returns 22. 
>>   I'm confused about the result. Why it changed by day or by the number 
>> of data in the measurement? or it's a bug?
>>
>> -- 
>> Remember to include the InfluxDB version number with all issue reports
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "InfluxDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/influxdb.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/influxdb/25fb92b7-60ab-4284-ab7f-3ebded6f4555%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/influxdb/25fb92b7-60ab-4284-ab7f-3ebded6f4555%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Sean Beckett
> Director of Support and Professional Services
> InfluxDB
>

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/03e323ad-5c7f-4605-8eac-6f2895901c6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to