Gunju-Ko / TIL

Today I Learn
0 stars 0 forks source link

KSQL - Show Stream, Describe #3

Open Gunju-Ko opened 3 years ago

Gunju-Ko commented 3 years ago

내용 정리

SHOW Streams

SHOW | LIST STREAMS [EXTENDED];

예제

-- See the list of streams currently registered:
SHOW STREAMS;

-- See extended information about currently registered streams:
LIST STREAMS EXTENDED; 

DESCRIBE

DESCRIBE (stream_name|table_name|STREAMS|TABLES) [EXTENDED];

예제

> DESCRIBE ip_sum;
 Field   | Type
-----------------------------------------
 IP      | VARCHAR(STRING)  (primary key)
 KBYTES  | BIGINT
-----------------------------------------
For runtime statistics and query details run: DESCRIBE <Stream,Table> EXTENDED
> DESCRIBE ip_sum EXTENDED;
Type                 : TABLE
Timestamp field      : Not set - using <ROWTIME>
Key format           : KAFKA
Value format         : JSON
Kafka output topic   : IP_SUM (partitions: 4, replication: 1)

 Field   | Type
-----------------------------------------
 IP      | VARCHAR(STRING)  (primary key)
 KBYTES  | BIGINT
-----------------------------------------

Queries that write into this TABLE
-----------------------------------
id:CTAS_IP_SUM - CREATE TABLE IP_SUM as SELECT ip,  sum(bytes)/1024 as kbytes FROM CLICKSTREAM window SESSION (300 second) GROUP BY ip EMIT CHANGES;

For query topology and execution plan run: EXPLAIN <QueryId>; for more information

Local runtime statistics
------------------------
messages-per-sec:      4.41   total-messages:       486     last-message: 12/14/17 4:32:23 PM GMT
  failed-messages:         0      last-failed:       n/a
(Statistics of the local ksqlDB server interaction with the Kafka topic IP_SUM)