From 43c8db95d807fbdbd9e00f19db1a8e7775df9533 Mon Sep 17 00:00:00 2001 From: Thomas Casteleyn Date: Wed, 8 May 2024 18:23:53 +0200 Subject: [PATCH] docs(outputs.postgresql): Add example to create index for tag columns (#15322) --- plugins/outputs/postgresql/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/outputs/postgresql/README.md b/plugins/outputs/postgresql/README.md index 5481b3d5c..327daffc8 100644 --- a/plugins/outputs/postgresql/README.md +++ b/plugins/outputs/postgresql/README.md @@ -274,6 +274,17 @@ tag_table_add_column_templates = [ ] ``` +#### Index + +Create an index on time and tag columns for faster querying of data. + +```toml +create_templates = [ + '''CREATE TABLE {{ .table }} ({{ .columns }})''', + '''CREATE INDEX ON {{ .table }} USING btree({{ .columns.Keys.Identifiers | join "," }})''' + ] +``` + ## Error handling When the plugin encounters an error writing to the database, it attempts to