Skip to content

fix #7847: optimize DeleteGuestCustomersAsync using batch deletes#8217

Open
Parthiban6316 wants to merge 1 commit into
nopSolutions:developfrom
Parthiban6316:issue-7847-optimize-delete-guests-batch
Open

fix #7847: optimize DeleteGuestCustomersAsync using batch deletes#8217
Parthiban6316 wants to merge 1 commit into
nopSolutions:developfrom
Parthiban6316:issue-7847-optimize-delete-guests-batch

Conversation

@Parthiban6316
Copy link
Copy Markdown

Problem

The current DeleteGuestCustomersAsync method deletes all guest
customers in a single massive DB operation using temporary tables
(tmp_guestsToDelete, tmp_guestsAddressesToDelete). On large stores
this causes:

  • SQL timeout errors / long running DB locks
  • Store main thread blocked waiting on DB
  • Failed tasks leaving orphan tmp_ tables behind
  • Next run crashing with "Table tmp_guestsToDelete already exists"

Solution

Replaced single bulk delete with batched processing (500 records
per batch). Each batch:

  • Fetches a small set of guest IDs
  • Deletes their generic attributes
  • Deletes their addresses
  • Deletes the customers themselves

Benefits

  • No more temp tables — no orphan table risk
  • Short DB locks per batch instead of one giant lock
  • Survives large datasets without timeouts
  • Faster overall due to smaller focused queries

Fixes #7847

… deletes to prevent DB locks and tmp_ table issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeleteGuests task issues

3 participants