Usage Specifications and Suggestions
This section describes the GeminiDB Influx instance specifications and provides suggestions for using GeminiDB Influx from the aspects of naming, TAG, FIELD, and query to solve common problems such as incorrect usage, low efficiency, and difficult maintenance.
Terms and Definition
- Rule: a convention that must be followed when you use GeminiDB Influx API.
- Suggestion: a convention that must be considered when you use GeminiDB Influx API.
Description
- Retention Policy (RP): includes information such as the data retention period and number of backups.
- Data objects: database, RP, MEASUREMENT, TAG, and FIELD
Naming
- Rules
- The name of a database object must start with a lowercase letter and consist of letters or digits. The length of the name cannot exceed 32 bytes.
- The name of a database object contains a maximum of 120 characters in the format of <Database name>.<RP name>.<MEASUREMENT name>.
- The name of the database object cannot use the system reserved keyword.
The system reserved keywords include: ALL,ALTER,ANY,AS,ASC,BEGIN,BY,CREATE,CONTINUOUS,DATABASE,DATABASES,DEFAULT,DELETE,DESC,DESTINATIONS,DIAGNOSTICS,DISTINCT,DROP,DURATION,END,EVERY,EXPLAIN,FIELD,FOR,FROM,GRANT,GRANTS,GROUP,GROUPS,IN,INF,INSERT,INTO,KEY,KEYS,KILL,LIMIT,SHOW,MEASUREMENT,MEASUREMENTS,NAME,OFFSET,ON,ORDER,PASSWORD,POLICY,POLICIES,PRIVILEGES,QUERIES,QUERY,READ,REPLICATION,RESAMPLE,RETENTION,REVOKE,SELECT,SERIES,SET,SHARD,SHARDS,SLIMIT,SOFFSET,STATS,SUBSCRIPTION,SUBSCRIPTIONS,TAG,TO,USER,USERS,VALUES,WHERE,WITH,WRITE,WARM
- The name of a database object cannot contain Chinese characters or the following special characters: ["].$,/\0*?~#:|'
- The database name cannot be the same as the database name used by systems such as _internal, _kapacitor, _heimdall, _vision and opentsdb.
- TAG names cannot be updated or renamed.
- Suggestions
- Shorter TAG names can save more resources because each tag name has an index which is stored in the memory.
- The names of TAG KEY and FIELD KEY cannot be the same.
TAG
- Rules
- Fields that use the InfluxQL function (such as MAX, MIN, and COUNT) are stored as FIELDs.
- TAG supports only the character string type. If the stored value is not of the character string type, the value is stored as FIELD.
- Suggestions
- TAG can distinguish data better than the MEASUREMENT name does.
- Design the TIME precision as required. Lower precision can bring better performance.
- The field often used as a search criterion is stored as a TAG.
- The field that uses GROUP BY is stored as a TAG.
FIELD
- Rule: The type of each field must be the same.
- Suggestion: The number of FIELDs should not be too large. Each FIELD is calculated independently. Too many FIELDs may cause the fuzzy query to fail.
Query
- Rules
- Do not run SELECT * FROM to query data.
- The query statement must contain the time range restriction.
- Before bringing a service online, perform a load test to measure the performance of the database in peak hours.
- Suggestions
- During the query, select only the fields that need to be returned.
- Shorter time range can bring better query performance.
- The more accurate the TAG value is, the better the query performance is. Use a single time series for query, that is, specify all TAG values or more TAG values.
- Add fill(none) after group by time intervals in queries. The function of fill(none) is that no timestamp or value is returned for an interval without data points. If there is sparse data, the number of returned query results can be greatly reduced.
- If nested queries are used, place the filter for querying time range in the outermost query.
DELETE
Suggestion: Do not execute the DELETE statement to delete data. Set a retention period so that data can be automatically deleted.
Others
- Rule: Select instance specifications based on the service time series scale, number of client connections, and number of retention policies. For details, see Instance Specifications.
If the database load exceeds the specification limit, unpredictable problems may occur. In severe cases, the database may be unavailable.
- Suggestion: Use a load balancer address to connect to the database. For details, see Connecting to an Instance Using a Load Balancer Address (Recommended).
- Note: If cold storage is enabled, cold data cannot be written.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot