

# Amazon Kinesis Data Streams system tables schema and example queries

This page describes the columns of the Amazon Kinesis Data Streams system table and provides example queries.

## Table schemas
<a name="system-tables-schema-tables"></a>

### streams
<a name="system-tables-schema-streams"></a>

Full name: `"s3tablescatalog/aws-catalog"."kinesis"."streams"`. Partitioned by `bucket(32, id)`.

The `streams` system table contains one row for each stream in your account and Region.

The following table describes the columns of the streams table.


| Column | Type | Required | Description | 
| --- | --- | --- | --- | 
| `id` | `string` | Yes | Unique identifier of the asset. | 
| `ingestion_time` | `timestamptz` | Yes | Time this asset record was ingested into the system table, in UTC. | 
| `update_time` | `timestamptz` | No | Time the asset was last updated in the AWS Glue Data Catalog, in UTC. | 
| `schema_version` | `string` | Yes | Identifier of this system table's column layout. Changes when a column is added, removed, renamed, or retyped. | 
| `created_time` | `timestamptz` | No | Time the resource was created, in UTC. | 
| `name` | `string` | No | The user-provided business name for the asset. | 
| `description` | `string` | No | The user-provided business description for the asset. | 
| `resource_name` | `string` | Yes | The resource's technical name. | 
| `resource_description` | `string` | No | The resource's technical description. | 
| `encryption_type_enum` | `string` | Yes | The encryption type used by the stream. Values: NONE, KMS. | 
| `max_record_size_in_ki_b` | `int` | Yes | The maximum size of a single record in kibibytes (KiB) that can be written to and read from the stream. | 
| `record_distribution_strategy_enum` | `string` | No | The record distribution strategy used by the stream. A value of `AUTO` indicates service-managed shard placement. A value of `USER_PARTITION_KEY` indicates shard placement is determined by the producer-supplied partition key. Only present for on-demand streams. Values: AUTO, USER\_PARTITION\_KEY. | 
| `retention_period_hours` | `int` | Yes | The current retention period of the stream, in hours. | 
| `stream_mode_enum` | `string` | Yes | The capacity mode of the stream. Values: ON\_DEMAND, PROVISIONED. | 
| `stream_status_enum` | `string` | Yes | The current status of the stream. Values: CREATING, ACTIVE, UPDATING, DELETING. | 
| `kms_key_id` | `string` | No | The identifier of the AWS KMS key that encrypts the resource at rest, as the source service reports it: a key ID, key ARN, alias name or alias ARN. | 

## Example queries
<a name="system-tables-example-queries"></a>

*Streams by capacity mode and encryption*

```sql
SELECT stream_mode_enum, encryption_type_enum, count(*) AS streams
FROM "s3tablescatalog/aws-catalog"."kinesis"."streams"
GROUP BY 1, 2;
```

*Streams with the longest retention*

```sql
SELECT resource_name, stream_mode_enum, retention_period_hours
FROM "s3tablescatalog/aws-catalog"."kinesis"."streams"
ORDER BY retention_period_hours DESC
LIMIT 20;
```