Skip to content

Use deleteAllInBatch for bulk contact deletion - #29

Merged
yamcodes merged 1 commit into
springfrom
27-optimize-delete-many
Mar 16, 2026
Merged

Use deleteAllInBatch for bulk contact deletion#29
yamcodes merged 1 commit into
springfrom
27-optimize-delete-many

Conversation

@yamcodes

@yamcodes yamcodes commented Mar 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces deleteAll with deleteAllInBatch in deleteMany(), issuing a single DELETE ... WHERE id IN (...) instead of N individual deletes

Closes #27

Test plan

  • Bulk delete multiple contacts and verify they are removed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Optimized bulk contact deletion operations.

Replaces deleteAll with deleteAllInBatch to issue a single bulk DELETE
statement instead of N individual deletes. Closes #27.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3eca6c1f-a68b-47e9-a255-9d9248063479

📥 Commits

Reviewing files that changed from the base of the PR and between 6e4376d and 516e17a.

📒 Files selected for processing (1)
  • src/main/java/codes/yam/contacts/ContactService.java

📝 Walkthrough

Walkthrough

The deleteMany() method in ContactService is optimized to use deleteAllInBatch() instead of deleteAll(), switching from individual entity deletions to a single bulk delete statement for better database efficiency.

Changes

Cohort / File(s) Summary
Database Deletion Optimization
src/main/java/codes/yam/contacts/ContactService.java
Changed deleteMany() method to call deleteAllInBatch(contacts) instead of deleteAll(contacts), reducing multiple individual DELETE statements to a single bulk operation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • 4 add bulk delete contacts #19: Related PR that added the deleteMany() method to ContactService, which is now being optimized in this change to use batch deletion for improved performance.

Poem

🐰 A batch delete hop, so spry and fleet,
One SQL statement instead of repeat,
No more N queries, just one clean sweep,
Efficiency gains for the database to keep!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: replacing deleteAll with deleteAllInBatch for bulk contact deletion.
Linked Issues check ✅ Passed The code changes fully implement the requirement from issue #27: ContactService.deleteMany now uses deleteAllInBatch instead of deleteAll.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objective; only the deletion method call in deleteMany was modified as required.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 27-optimize-delete-many
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yamcodes
yamcodes merged commit a198995 into spring Mar 16, 2026
1 check passed
@yamcodes
yamcodes deleted the 27-optimize-delete-many branch March 16, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant