Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize mysql query with trilogy gem #222

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

taketo1113
Copy link
Contributor

It optimize mysql query with trilogy gem
fixed #221

  • after fix with trilogy gem (same query with mysql2 gem)
Delayed::Backend::ActiveRecord::Job Update All (0.7ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2023-12-11 08:37:43', `delayed_jobs`.`locked_by` = 'host:taketo-mac-mini.local pid:28566' WHERE (((run_at <= '2023-12-11 08:37:43.120067' AND (locked_at IS NULL OR locked_at < '2023-12-11 04:37:43.120069')) OR locked_by = 'host:taketo-mac-mini.local pid:28566') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
  • before fix with trilogy gem
Delayed::Backend::ActiveRecord::Job Load (0.2ms)  SELECT `delayed_jobs`.`id` FROM `delayed_jobs` WHERE (((run_at <= '2023-12-02 07:44:11.604515' AND (locked_at IS NULL OR locked_at < '2023-12-02 03:44:11.604530')) OR locked_by = 'host:taketo-mac-mini.local pid:6304') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5

@taketo1113
Copy link
Contributor Author

FYI: The adapter name of trilogy gem is Trilogy
It define rails/rails repository.

https://github.com/rails/rails/blob/7-1-stable/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb#L44

@albus522 albus522 merged commit ae37fa0 into collectiveidea:master Aug 13, 2024
@taketo1113 taketo1113 deleted the optimized-query-trilogy branch August 14, 2024 00:39
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.

Don't optimize mysql query with trilogy gem
2 participants