Percision setting

#1

How can i view the percision setting for each db?

#2

Hi @ntbritton ,

the precision on database level , for the moment , is always nanoseconds

best regards

#3

I am looking for away to know what the setting is. I am unsure if there have been updates to the defaults. How can i check that setting?

#4

The setting is nanaoseconds because the defaults cannot be changed on database level .

#5

so the percision command is a global change?

Such as “percision s”

#6

in influx you mean ?
Like

influx -database telegraf
> precision s
> insert precisiontest field1=30

> select * from precisiontest
name: precisiontest
time       field1
----       ------
1555495327 30
> precision ns

> select * from precisiontest
name: precisiontest
time                field1
----                ------
1555495327000000000 30

> insert precisiontest field1=40

> select * from precisiontest
name: precisiontest
time                field1
----                ------
1555495327000000000 30
1555495360531353155 40

that only affects your current session …

#7

okay. I was thinking it would change the setting for the db, and that would then force all entries to seconds.

I am trying to push a bunch of historical data, that will be charted using graphna. What i am seeing is that only points in ns are showing up and not the historical ones in seconds that i am pushing.

Am i missing something?

I am doing this from powershell and getting the data 2018-05 to present as a ns number is difficult.

#8

Probably the data you are pushing is dropped ?
If you insert records with a precision in seconds for example : 1555496690,
the database will think the year is 1970 …

> precision ns

> insert precisiontest field="ns" 1555496690000000000

> insert precisiontest field="s" 1555496690
ERR: {"error":"partial write: points beyond retention policy dropped=1"}

> show retention policies
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 720h0m0s 168h0m0s           1        true

> alter retention policy autogen on telegraf duration inf

> insert precisiontest field="s" 1555496690


> precision rfc3339
> select * from precisiontest
name: precisiontest
time                          field
----                          -----
1970-01-01T00:00:01.55549669Z s
2019-04-17T10:24:50Z          ns
>

You could use telegraf to ingest the data because in telegraf you can specify a precision …

It is also a good idea to temporarily enlarge the shard duration before ingesting your historical data

#9

So in short, i need to figure out how to get the date to be a nanosecond date right?

If so any idea how one can do that in powershell?

#10

Hi some examples …

echo ([int64]((Get-Date(“04/17/2019 10:00:05”))-(Get-Date -Date ‘1/1/1970’)).TotalMilliseconds * 1000000)

echo ([int64]((Get-Date(“05/01/2018”))-(Get-Date -Date ‘1/1/1970’)).TotalMilliseconds * 1000000)

echo ([int64]((Get-Date -Year 2019 -month 5)-(Get-Date -Date ‘1/1/1970’)).TotalMilliseconds * 1000000)

#11

I went another way, since i dont need the nanosecond time.

i used this for the uri ‘http://server:8086/write?db=Database&precision=s