diff --git a/docs/references/restate-sql-introspection.mdx b/docs/references/restate-sql-introspection.mdx index 2cf3c5f7..5ec6ed86 100644 --- a/docs/references/restate-sql-introspection.mdx +++ b/docs/references/restate-sql-introspection.mdx @@ -5,39 +5,41 @@ description: "API reference for inspecting the invocation status and service sta # Restate SQL Introspection API -Restate exposes two tables that can be queried via `psql`. +Restate exposes two tables that can be queried via [psql](https://www.postgresql.org/docs/current/app-psql.html). The schema of these tables is described in the following. ## Table: `state` -| Column name | type | description | example | +| Column name | Type | Description | Example | | ----------------- | ------ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------------------------------------------- | -| `partition_key` | `UInt32` | Internal column that is used for partitioning the services invocations. Can be ignored. | | -| `service` | `utf8` | The name of the invoked service | `foo.bar.Greeter` | -| `service_key_utf8` | `utf8` | Only contains meaningful values when a service uses a `utf8` Restate key | `bob` | -| `service_key_int32` | `Int32` | Only contains meaningful values when a service uses an `int32` Restate key | `1337` | -| `service_key_uuid` | `utf8` | Only contains meaningful values for unkeyed Restate services | `0189bab3b3397d828e979e2548980fa6` | -| `key` | `utf8` | The `utf8` user-supplied state key | A snippet like `ctx.set(“seen”, 1);` Will produce a value like: `seen` | +| `partition_key` | `uint32` | Internal column that is used for partitioning the services invocations. Can be ignored. | | +| `service` | `utf8` | The name of the invoked service. | `foo.bar.Greeter` | +| `service_key` | `binary` | A binary, uninterpreted representation of the service key. You can use a more specific column based on the type of your key, such as `service_key_utf8` (for string keys), `serivce_key_uuid` for unkeyed services, or `service_key_int32` for integer keys.| | +| `service_key_utf8` | `utf8` | Only contains meaningful values when a service uses a `utf8` Restate key. | `bob` | +| `service_key_int32` | `int32` | Only contains meaningful values when a service uses an `int32` Restate key. | `1337` | +| `service_key_uuid` | `utf8` | Only contains meaningful values for unkeyed Restate services. | `0189bab3b3397d828e979e2548980fa6` | +| `key` | `utf8` | The `utf8` user-supplied state key. | A snippet like `ctx.set(“seen”, 1);` Will produce a value like: `seen` | +| `value` | `binary` | A binary, uninterpreted representation of the value. You can use the more specific column `value_utf8` if the value is a string. | | | `value_utf8` | `utf8` | Only contains meaningful values when a service stores state as `utf8`. This is the case for Typescript services since the Typescript SDK serializes values as JSON. | `1` | -| `value` | | | | ## Table: `sys_status` -| Column name | type | description | example | +| Column name | Type | Description | Example | | ------------------ | ------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| -| `partition_key` | `UInt32` | Internal column that is used for partitioning the services invocations. Can be ignored. | | -| `service` | `utf8` | The name for the invoked service | `foo.bar.Greeter` | -| `method` | `utf8` | The invoked RPC method | `greet` | -| `service_key_utf8` | `utf8` | Only contains meaningful values when a service uses a `utf8` Restate key | `bob` | -| `service_key_int32` | `Int32` | Only contains meaningful values when a service uses an `int32` Restate key | `1337` | -| `service_key_uuid` | `utf8` | Only contains meaningful values for unkeyed Restate services | `0189bab3b3397d828e979e2548980fa6` | -| `status` | `utf8` | Enum value: `invoked` or `suspended` | | -| `invocation_id` | `utf8` | Restate-generated invocation ID | `0189baba86ea76b2a0efc37db88ea9a5` | -| `sid` | `utf8` | Service invocation ID, an opaque token that can be used to cancel an invocation of a service with the [admin API](/references/admin-api) | | -| `invoked_by` | `utf8` | Enum describing the invoker of this service: `ingress` = invoked externally / `service` = invoked by a service | | +| `partition_key` | `uint32` | Internal column that is used for partitioning the services invocations. Can be ignored. | | +| `service` | `utf8` | The name for the invoked service. | `foo.bar.Greeter` | +| `method` | `utf8` | The invoked RPC method. | `greet` | +| `service_key` | `binary` | A binary, uninterpreted representation of the service key. You can use a more specific column based on the type of your key, such as `service_key_utf8` (for string keys), `serivce_key_uuid` for unkeyed services, or `service_key_int32` for integer keys.| | +| `service_key_utf8` | `utf8` | Only contains meaningful values when a service uses a `utf8` Restate key. | `bob` | +| `service_key_int32` | `int32` | Only contains meaningful values when a service uses an `int32` Restate key. | `1337` | +| `service_key_uuid` | `utf8` | Only contains meaningful values for unkeyed Restate services. | `0189bab3b3397d828e979e2548980fa6` | +| `status` | `utf8` | Enum value: `invoked` or `suspended`. | | +| `invocation_id` | `utf8` | Restate-generated invocation ID. | `0189baba86ea76b2a0efc37db88ea9a5` | +| `sid` | `utf8` | Service invocation ID, an opaque token that can be used to cancel an invocation of a service with the [admin API](/references/admin-api). | | +| `invoked_by` | `utf8` | Enum describing the invoker of this service: `ingress` = invoked externally / `service` = invoked by a service. | | | `invoked_by_service` | `utf8` | The name of the invoking service. Or `null` if invoked via the ingress. | `com.example.Greeter` | | `invoked_by_sid` | `utf8` | The service invocation ID of the service that triggered this invocation. Or `null` if invoked via the ingress. | | | `trace_id` | `utf8` | The ID of the trace that is assigned to this invocation. Only relevant when tracing is enabled. | | -| `journal_size` | `uint32` | The number of journal entries durably logged for this invocation | | +| `journal_size` | `uint32` | The number of journal entries durably logged for this invocation. | | | `created_at` | `date64` | Timestamp indicating the start of this invocation. | | -| `modified_at` | `date64` | Timestamp indicating the last state transition. For example, last time the status changed from `invoked` to `suspended`. | | \ No newline at end of file +| `modified_at` | `date64` | Timestamp indicating the last state transition. For example, last time the status changed from `invoked` to `suspended`. | |