Skip to content

Improvement/remove-unused-query#1

Draft
faridatulna wants to merge 3 commits intomasterfrom
improvement/remove-unused-query
Draft

Improvement/remove-unused-query#1
faridatulna wants to merge 3 commits intomasterfrom
improvement/remove-unused-query

Conversation

@faridatulna
Copy link
Copy Markdown
Member

Verdicts

$withCount adds overhead on find(): The Tag model's $withCount = ['subscribers'] appends a correlated count subquery even though update() never uses subscribers_count. The count is wasted here.

$withCount = ['subscribers'] on Tag model: Every query on Tag (including the find() call here) carries a correlated subquery counting subscribers. This is unnecessary overhead inside store().

@faridatulna faridatulna self-assigned this Apr 14, 2026
@faridatulna faridatulna force-pushed the improvement/remove-unused-query branch from 62782ff to 89ea82c Compare April 14, 2026 08:52
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bang @habibimustafa, diaku kalau migration ini dijalankan kena error:

SQLSTATE[HY000]: General error: 1553 Cannot drop index 'idx_tag_subscriber': needed in a foreign key constraint (Connection: mysql, SQL: alter table sendportal_tag_subscriber drop index idx_tag_subscriber)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya benerin aja, nanti aku merge

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kayaknya perlu 2 step itu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aku udah edit @faridatulna coba cek master

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants