collectd: Improve database schema
- Dominant language
- No language data
- Stars
- 3
- Forks
- 4
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
## Pitch
@coderabbitai's review at https://github.com/crate/cratedb-guide/pull/330#pullrequestreview-3249194513 yielded this recommendation.
`63-76`: **Align table types with arrays and avoid TIMESTAMPTZ ambiguity.**
CrateDB handles TIMESTAMP in UTC; storing arrays as arrays eases querying (unnest/ANY). Also keep the generated monthly partition.
```diff
CREATE TABLE doc.collectd_data (
- p_time timestamp with time zone,
- p_host TEXT,
- p_plugin TEXT,
- p_plugin_instance TEXT,
- p_type TEXT,
- p_type_instance TEXT,
- p_value_names TEXT,
- p_type_names TEXT,
- p_values TEXT,
- month GENERATED ALWAYS AS date_trunc('month',p_time)
+ p_time TIMESTAMP,
+ p_host TEXT,
+ p_plugin TEXT,
+ p_plugin_instance TEXT,
+ p_type TEXT,
+ p_type_instance TEXT,
+ p_value_names ARRAY(TEXT),
+ p_type_names ARRAY(TEXT),
+ p_values ARRAY(DOUBLE PRECISION),
+ month GENERATED ALWAYS AS date_trunc('month', p_time)
) PARTITIONED BY (month);
```
## References
- https://github.com/crate/tech-content/issues/131
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.