You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/ddsql_reference/_index.md
+72Lines changed: 72 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ This documentation covers the SQL support available and includes:
33
33
-[SQL functions](#functions)
34
34
-[Window functions](#window-functions)
35
35
-[JSON functions](#json-functions-and-operators)
36
+
-[Table functions](#table-functions)
36
37
-[Tags](#tags)
37
38
38
39
@@ -453,6 +454,77 @@ This table provides an overview of the supprted window functions. For comprehens
453
454
| json_extract_path_text(text json, text path…) | text | Extracts a JSON sub-object as text, defined by the path. Its behavior is equivalent to the [Postgres function with the same name][3]. For example, `json_extract_path_text(col, ‘forest')` returns the value of the key `forest` for each JSON object in `col`. See the example below for a JSON array syntax.|
454
455
| json_extract_path(text json, text path…) | JSON | Same functionality as `json_extract_path_text`, but returns a column of JSON type instead of text type.|
Querying Logs and Metrics through DDSQL is in Preview. Use this form to request access.
461
+
{{< /callout >}}
462
+
463
+
Table functions are used to query Logs and Metrics
464
+
465
+
<tablestyle="width: 100%; table-layout: fixed;">
466
+
<thead>
467
+
<tr>
468
+
<th style="width: 33%;">Function</th>
469
+
<th style="width: 33%;">Description</th>
470
+
<th style="width: 33%;">Example</th>
471
+
</tr>
472
+
</thead>
473
+
<tbody>
474
+
<tr>
475
+
<td>
476
+
<pre>
477
+
dd.logs(
478
+
filter => varchar,
479
+
columns => array < varchar >,
480
+
indexes ? => array < varchar >,
481
+
from_timestamp ? => timestamp,
482
+
to_timestamp ? => timestamp
483
+
) AS (column_name type [, ...])</pre>
484
+
</td>
485
+
<td>Returns log data as a table. The columns parameter specifies which log fields to extract, and the AS clause defines the schema of the returned table. Optional: filtering by index or time range. When time is not specified, we default to the past 1 hour of data.</td>
<td>Returns metric data as a scalar value. The function accepts a metrics query (with optional grouping), a reducer to determine how values are aggregated (avg, max, etc.), and optional timestamp parameters (default 1 hour) to define the time range.</td>
509
+
<td>
510
+
{{< code-block lang="sql" >}}
511
+
SELECT *
512
+
FROM dd.metric_scalar(
513
+
'avg:system.cpu.user{*} by {service}',
514
+
'avg',
515
+
TIMESTAMP '2025-07-10 00:00:00.000-04:00',
516
+
TIMESTAMP '2025-07-17 00:00:00.000-04:00'
517
+
)
518
+
ORDER BY value DESC;{{< /code-block >}}
519
+
</td>
520
+
</tr>
521
+
</tbody>
522
+
</table>
523
+
524
+
525
+
526
+
527
+
456
528
## Tags
457
529
458
530
DDSQL exposes tags as an `hstore` type, which you can query using the PostgreSQL arrow operator. For example:
0 commit comments