sync_vendor_data_task executes the same SELECT … FROM data_source query once per record during sync, resulting in an N+1 problem. In a single transaction the query pattern repeats ~85 times alongside individual INSERT INTO event_record and INSERT INTO event_record_detail statements.
Impact: 255 occurrences detected on our internal instance since Feb 6. Adds unnecessary DB load on every vendor data sync.
Fix: Pre-fetch/cache data_source lookups before the loop and batch event_record / event_record_detail inserts using bulk_save_objects or executemany.