Are there tutorials online that teaches you how to create tables and input values in InfluxDB? How would you create a table and insert values into them?
-
Why did I receive a thumbs down? – gordon sung Sep 09 '16 at 19:11
-
3Upvoted this one. Questions must not be downvoted because the documentation on a framework is poor. – wavicle Sep 17 '17 at 23:01
3 Answers
InfluxDB doesn't really have the concept of a table. Data is structured into series, which is composed of measurements, tags, and fields.
Measurements are like buckets.
Tags are indexed values.
Fields are the actual data.
Data is written into InfluxDB via line protocol. The structure of line protocol is as follows
<measurement>,<tag>[,<tags>] <field>[,<field>] <timestamp>
An example of a point in line protocol:
weather,location=us-midwest temperature=82 1465839830100400200
To insert data into the database you'll need to issue an HTTP POST request to the /write
endpoint, specifying the db
query parameter.
For example:
curl -XPOST http://localhost:8086/write?db=mydb --data-binary "weather,location=us-midwest temperature=82 1465839830100400200"
For more information see the Getting Started section of the InfluxDB docs.

- 4,607
- 24
- 19
-
additionally as the get-started says: you can use an insert statement with the CLI, such as this: INSERT weather,location=us-midwest temperature=82 1465839830100400200 – Packet Tracer Nov 24 '16 at 10:13
-
1And just to be clear, "
" in the above example really means measurement type (although the "weather" "measurement" (type) value in the above example is really more of a category of measurement types, maybe not the best example). I think a better teaching example for a data row might be (intentionally verbose for teaching): 'temperature_measurement,location=us-midwest temperature_value=82 1465839830100400200' – Ben Slade May 07 '20 at 20:20
I just want to quote the moderator of the influxdata community here:
You can think of
- measurements as tables in SQL,
- tags as indexed columns,
- and fields as unindexed columns

- 13,037
- 1
- 44
- 67
-
And "tag keys" are the names of the indexed columns, "tag values" are the values for a tag column with a given tag key (index column name). Field "keys" (also called field "names") are the names of unindexed columns and field values are the values of the respective unindexed column. Note, you can only used tag key/name & tag values in "show measurements" commands (a "measurement" (in the influx sense of the word) is table holding rows where the rows are the actual data measurements (in the english sense of the word)) – Ben Slade Apr 15 '21 at 21:10
Also, there is no "create table" statement. Just insert to a table. The web call was specified above. If you have the "influx" command line interpreter, you can do:
export INFLUX_PASSWORD="BlahBlahBlah"
influx -host <hostname> -u <username> -d <database>
insert my_influx_test_measurement,index1="aaa" value1="bbb"
Note that "insert" is only a command line (aka "influx") thing. Doesn't work with http calls.
It's to bad they named the command line interpreter "influx". Now when anyone refers to "influx", it's not clear if it's the database or the CLI.

- 478
- 5
- 11