Databases

MySQL replica lag grows during nightly imports

Environment

Environment

MySQL 8 primary with one asynchronous replica and a nightly CSV import job.

What happens

What happens

Replica delay reaches forty minutes although CPU and network remain moderate.

What I have tried

What I have tried

Increased replica parallel workers and moved the import outside peak traffic.

I would appreciate advice on how to identify the root cause without risking existing data or configuration.

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 3w ago• Trouble ID

Most likely causes

Large transactions serialize replication and retain locks until the entire batch commits. 86%
A recent software, firmware or configuration change is exposing an existing compatibility issue. 40%

Summary

The reported behaviour is consistent with large transactions serialize replication and retain locks until the entire batch commits. The safest next step is to verify that hypothesis with a reversible test before making permanent configuration changes.

Suggested Fixes

Verify the likely cause
Import in smaller committed batches, preserve primary-key order and inspect replication worker utilization before adding more threads.
Validate and monitor
Reproduce the issue once after the change, review relevant logs or metrics, and keep a rollback path until the system has remained stable.

Continue troubleshooting

Matched from the title, description and tags