Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-1078

Optimize sys.fn_cdc_map_lsn_to_time() calls

    XMLWordPrintable

    Details

      Description

      In streaming phase, a sys.fn_cdc_map_lsn_to_time() stored procedure is executed for each row. This might be a performance bottleneck.

      io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource#offsetContext

      offsetContext.setSourceTime(connection.timestampOfLsn(commitLsn));
      
      • We can take advantage of the fact that the stored procedure is called for commitLsn, which, in general, can be the same for many rows. Even having a simple LRU cache which keeps a few entries we can significantly reduce the number of such queries.
      • Updating sourceTime can be optional (via configuration).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            grzegorzk Grzegorz KoĊ‚akowski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: