OBSERVE_ DATABASE_ OFFSETS
On this page
This view contains information on offsets for starting an OBSERVE
query.OBSERVE
query.OBSERVE
queries from offsets that have not been processed (observed).
Schema
Column Name |
Description |
---|---|
|
ID of a database |
|
Name of the database. |
|
ID of the partition on the leaf node. |
|
Offset of the |
|
Offset type.
|
For example:
SELECT * FROM information_schema.OBSERVE_DATABASE_OFFSETS;
+-------------+---------------+---------+------------------------------------------------------------+----------------+
| DATABASE_ID | DATABASE_NAME | ORDINAL | OFFSET | OFFSET_TYPE |
+-------------+---------------+---------+------------------------------------------------------------+----------------+
| 1 | x_db | 0 | 0x00000000000000040000000000000002000000000000000000000000 | log_tail |
| 1 | x_db | 0 | 0x00000000000000010000000000000000000000000000104B00000000 | snapshot_end |
| 1 | x_db | 0 | 0x00000000000000010000000000000000000000000000000000000000 | snapshot_begin |
| 1 | x_db | 1 | 0x00000000000000050000000000000002000000000000000000000000 | log_tail |
| 1 | x_db | 1 | 0x00000000000000010000000000000000000000000000104B00000000 | snapshot_end |
| 1 | x_db | 1 | 0x00000000000000010000000000000000000000000000000000000000 | snapshot_begin |
+-------------+---------------+---------+------------------------------------------------------------+----------------+
Examples
-
Query the tail offset for each partition, ordered by
ORDINAL
:SELECT OFFSETFROM information_schema.OBSERVE_DATABASE_OFFSETSWHERE DATABASE_NAME='<database>' and OFFSET_TYPE='log_tail'ORDER BY ORDINAL; -
Query the latest snapshot end offsets for each partition.
Replace OFFSET_
withTYPE snapshot_
to get the latest snapshot begin offsets.begin SELECT OFFSET FROM (SELECT *, ROW_NUMBER()OVER (PARTITION BY DATABASE_NAME, ORDINAL, OFFSET_TYPEORDER BY OFFSET DESC) AS VersionFROM information_schema.OBSERVE_DATABASE_OFFSETSWHERE DATABASE_NAME='<database>' AND OFFSET_TYPE='snapshot_end')WHERE Version=1ORDER BY ORDINAL;
Last modified: November 18, 2024