Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ content/en/code_analysis/ @Datadog/static-analysis @Data
content/en/quality_gates/ @Datadog/ci-app-backend @Datadog/documentation

# DDSQL Editor References
content/en/ddsql_reference/*.md @Datadog/xpq @Datadog/documentation @Datadog/advanced-query-guild
content/en/ddsql_reference/*.md @Datadog/documentation @Datadog/advanced-query-guild
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xpq reps are part of the advanced-query-guild group, so it's redundant to include them here twice


# Data Streams Monitoring
content/en/data_streams/*.md @Datadog/data-streams-monitoring @Datadog/documentation
Expand Down
12 changes: 10 additions & 2 deletions content/en/ddsql_reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ ORDER BY value DESC;{{< /code-block >}}

## Tags

DDSQL exposes tags as an `hstore` type, which you can query using the PostgreSQL arrow operator. For example:
DDSQL exposes tags as an `hstore` type, which is inspired by PostgreSQL. You can access the values for specific tag keys using the PostgreSQL arrow operator. For example:

```sql
SELECT instance_type, count(instance_type)
Expand All @@ -686,7 +686,15 @@ WHERE tags->'region' = 'us-east-1' -- region is a tag, not a column
GROUP BY instance_type
```

Tags are key-value pairs where each key can have zero, one, or multiple values. When accessed, the tag value returns a string containing all corresponding values.
Tags are key-value pairs where each key can have zero, one, or multiple tag values corresponding to it. When accessed, the tag value returns a single string, containing _all_ corresponding values. When the data has multiple tag values for the same tag key, they are represented as a sorted, comma-separated string. For example:

```sql
SELECT tags->'team', instance_type, architecture, COUNT(*) as instance_count
FROM aws.ec2_instance
WHERE tags->'team' = 'compute_provisioning,database_ops'
GROUP BY tags->'team', instance_type, architecture
ORDER BY instance_count DESC
```

You can also compare tag values as strings or entire tag sets:

Expand Down
Loading