Discussion:
[influxdb] Can you use a regex to insert into a new measurement?
b***@gmail.com
2017-06-27 07:51:00 UTC
Permalink
Hi all,

My current situation is as follows: customers can create transactions on my website. These transactions are stored in a separate measurement for each customer. These measurements follow the naming scheme [customerId]-transactions. So for example, a customer with ID 123 would have the measurement with name "123-transactions". An example row in these measurements would be:

Timestamp | Value | Country | CustomCode
-----------------------------------------------
121245561 | 12.56 | USA | abc123
121245572 | 22 | Germany | foobar

The country is a tag, and there are a couple more tags in this measurement which are not shown in this example. The CustomCode is a field, as there are a lot of unique ones for each customer. I would like to be able to turn CustomCode into a tag, as I want to do groupby queries on that with high performance. However, combined with other tags this would greatly increase cardinality.


To be able to do group by queries on CustomCode, I would like to create a continuous query that takes the value of CustomCode and inserts it into a new measurement as its only tag. I have figured out how to do a select query from all [customerId]-transactions measurements at the same time. However, I would like to create a single continuous query that creates a new measurement for each existing measurement. So if I have two measurements called "123-transactions" and "456-transactions", I would like to create two new measurements "123-transactions-groupedByCustomCode" and "456-transactions-groupedByCustomCode".

Is this possible with a single continuous query?
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/98f68dea-c609-4a18-a9ec-db1e9fd3fa86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...