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

Add indexes to mining and message waits tables #162

Merged
merged 1 commit into from
Aug 20, 2024
Merged

Conversation

magik6k
Copy link
Collaborator

@magik6k magik6k commented Aug 20, 2024

  • Mining base lookups were the 3rd most time-consuming query in my stats, due to the winnnigPoSt task looking up the mining base by task_id which wasn't indexed
  • Message waits are updated by joining waits with non-null waiter machine to message sends on signed cid. Because neither column had an index each invocation would trigger an insanely expensive sequential of both tables on every epoch, making it the second most expensive query.

Most time-consuming is

SELECT id 
			FROM harmony_task
			WHERE owner_id IS NULL AND name=$1
			ORDER BY update_time

But this one is expensive purely because it's executed very frequently, the execution itself seems to be very cheap with avg time at ~8ms on my cluster; Also does basically no IO since it's all going to be in memory due to that table being tiny

@magik6k magik6k requested review from snadrus and LexLuthr August 20, 2024 21:21
@snadrus snadrus merged commit 60b92d9 into main Aug 20, 2024
1 check was pending
@snadrus snadrus deleted the fix/add-more-indexes branch August 20, 2024 21:23
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