Why measurement's points count is less than inserted?

influxdb
#1

I import a large txt file,in the process,influx command shows:

2017/06/12 15:27:32 Processed 3500000 lines. Time elapsed: 9m22.76060738s. Points per second (PPS): 6219
2017/06/12 15:27:48 Processed 3600000 lines. Time elapsed: 9m39.058952769s. Points per second (PPS): 6216
2017/06/12 15:28:04 Processed 3700000 lines. Time elapsed: 9m55.054581404s. Points per second (PPS): 6217
2017/06/12 15:28:20 Processed 3800000 lines. Time elapsed: 10m11.105580349s. Points per second (PPS): 6218
2017/06/12 15:28:36 Processed 3900000 lines. Time elapsed: 10m27.15810846s. Points per second (PPS): 6218

So at least the measurement should have 3900000 points,but when I countSELECT COUNT(field) FROM hb_mysql_metric,it shows just 348682!

SELECT COUNT(field) FROM hb_mysql_metric
name: hb_mysql_metric
time count
---- -----
0 348682

And my txt file doesn’t include the timestamp primary key,and during importing,there is no error;So, Why measurement’s points count is less than inserted?

#2

@leafonsword Based on this report here I would guess that you have some series that are overwriting each other. The primary key in InfluxDB is the timestamp, so if you are writing a bunch of data at the same time the database server will set the timestamp. This can lead to overwritten data as the last write wins.

#3

Here’s a minimal example of what Jack is describing:

$ curl -XPOST localhost:8086/query?q=CREATE+DATABASE+junk
{"results":[{"statement_id":0}]}

$ curl -XPOST localhost:8086/write?db=junk --data-binary 'm,tag=a n=1
> m,tag=b n=2
> m,tag=a n=3
> '

$ curl -XPOST localhost:8086/query?db=junk --data-urlencode "q=SELECT * FROM m"
{"results":[{"statement_id":0,"series":[{"name":"m","columns":["time","n","tag"],"values":[["2017-06-12T16:20:38.13041401Z",3,"a"],["2017-06-12T16:20:38.13041401Z",2,"b"]]}]}]}

We write tag=a, tag=b, and tag=a again in the same batch without explicit timestamps. The last tag=a is the one that’s persisted.

#4

@jackzampolin @mark
thx~
That was the cause~