📣新登場!TiDB Cloud BYOC、TiDB Cloud Filesystem、PostgreSQL-compatible TiDB Cloud Starter がパブリックプレビュー中。このページは自動翻訳されたものです。原文はこちらからご覧ください。

STREAM_STATUS



指定したストリームのステータスに関する情報を提供し、true または false を取りうる単一カラムの結果(has_data)を返します。

  • true: ストリームに変更データキャプチャレコードが含まれている可能性があることを示します。
  • false: 現在、ストリームに変更データキャプチャレコードが含まれていないことを示します。

構文

SELECT * FROM STREAM_STATUS('<database_name>.<stream_name>'); -- OR SELECT * FROM STREAM_STATUS('<stream_name>'); -- Uses current database

例

-- Create a table 't' with a column 'c' CREATE TABLE t (c int); -- Create a stream 's' on the table 't' CREATE STREAM s ON TABLE t; -- Check the initial status of the stream 's' SELECT * FROM STREAM_STATUS('s'); -- The result should be 'false' indicating no change data capture records initially ┌──────────┐ │ has_data │ ├──────────┤ │ false │ └──────────┘ -- Insert a value into the table 't' INSERT INTO t VALUES (1); -- Check the updated status of the stream 's' after the insertion SELECT * FROM STREAM_STATUS('s'); -- The result should now be 'true' indicating the presence of change data capture records ┌──────────┐ │ has_data │ ├──────────┤ │ true │ └──────────┘ -- Example with database name specified SELECT * FROM STREAM_STATUS('mydb.s');

このページは役に立ちましたか?