Sidekiq is not database aware. So Sidekiq will do whatever it asked to do. Sidekiq does it efficiently. Sidekiq is super fast.
So sometimes you’ll hit "Sidekiq is too fast" problem, one of them being a job got executed but the transaction is not committed yet. As described in details at Delay job push within DB transaction #5239.
Good news is Sidekiq has introduced a beta feature (as of May 28, 2022), a transaction-aware client that will push job after transaction committed using after_commit_everywhere.
You can implement yourself now by doing some ActiveRecord Transaction business.