OBSERVE_DATABASE_OFFSETS

On this page

This view contains information on offsets for starting an OBSERVE query. It contains offsets for each partition (ordinal) of a database observed by an OBSERVE query. This view enables users to start OBSERVE queries from offsets that have not been processed (observed). Refer to Change Data Capture for more information.

Schema

Column Name

Description

DATABASE_ID

ID of a database

DATABASE_NAME

Name of the database.

ORDINAL

ID of the partition on the leaf node.

OFFSET

Offset of the OBSERVE query.

OFFSET_TYPE

Offset type. It has one of the following values:

  • log_tail: Identifies the tail offset of the log for a database. This value is unique for a database for each partition.

  • snapshot_begin: Identifies the beginning offset of a snapshot.

  • snapshot_end: Identifies the end offset of a snapshot.

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 OFFSET
    FROM information_schema.OBSERVE_DATABASE_OFFSETS
    WHERE DATABASE_NAME='<database>' and OFFSET_TYPE='log_tail'
    ORDER BY ORDINAL;
  • Query the latest snapshot end offsets for each partition. Replace OFFSET_TYPE with snapshot_begin to get the latest snapshot begin offsets.

    SELECT OFFSET FROM (
    SELECT *, ROW_NUMBER()
    OVER (PARTITION BY DATABASE_NAME, ORDINAL, OFFSET_TYPE
    ORDER BY OFFSET DESC) AS Version
    FROM information_schema.OBSERVE_DATABASE_OFFSETS
    WHERE DATABASE_NAME='<database>' AND OFFSET_TYPE='snapshot_end')
    WHERE Version=1
    ORDER BY ORDINAL;

Last modified: November 18, 2024

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK