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

Optimize sys.fn_cdc_map_lsn_to_time() calls

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 0.9.0.CR1
    • 0.9.0.Beta2
    • sqlserver-connector
    • None

      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).

              Unassigned Unassigned
              grzegorz.kolakowski Grzegorz KoĊ‚akowski (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: