Help Center> GeminiDB> GeminiDB Influx API> Service Overview> Usage Specifications and Suggestions
Updated on 2023-11-21 GMT+08:00

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
    1. 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.
    2. The name of a database object contains a maximum of 120 characters in the format of <Database name>.<RP name>.<MEASUREMENT name>.
    3. 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

    4. The name of a database object cannot contain Chinese characters or the following special characters: ["].$,/\0*?~#:|'
    5. The database name cannot be the same as the database name used by systems such as _internal, _kapacitor, _heimdall, _vision and opentsdb.
    6. TAG names cannot be updated or renamed.
  • Suggestions
    1. Shorter TAG names can save more resources because each tag name has an index which is stored in the memory.
    2. The names of TAG KEY and FIELD KEY cannot be the same.

TAG

  • Rules
    1. Fields that use the InfluxQL function (such as MAX, MIN, and COUNT) are stored as FIELDs.
    2. 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
    1. TAG can distinguish data better than the MEASUREMENT name does.
    2. Design the TIME precision as required. Lower precision can bring better performance.
    3. The field often used as a search criterion is stored as a TAG.
    4. 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
    1. Do not run SELECT * FROM to query data.
    2. The query statement must contain the time range restriction.
    3. Before bringing a service online, perform a load test to measure the performance of the database in peak hours.
  • Suggestions
    1. During the query, select only the fields that need to be returned.
    2. Shorter time range can bring better query performance.
    3. 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.
    4. 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.
    5. If nested queries are used, place the filter for querying time range in the outermost query.

Delete

Suggestion: Do not use the DELETE method to delete data. Set a proper retention period (RP) as required 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 ELB to connect to the database. For details, see Connecting to an Instance Using a Load Balancer Address (Recommended).
  • Suggestion: After cold storage is enabled, do not write the data if data within a period of time has been transferred into cold storage. Otherwise, an error may occur.