Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Audit log slows to a crawl when nearing 1 million entries #17689

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

Open
mafredri opened this issue May 6, 2025 · 0 comments
Open

Audit log slows to a crawl when nearing 1 million entries #17689

mafredri opened this issue May 6, 2025 · 0 comments

Comments

@mafredri
Copy link
Member

mafredri commented May 6, 2025

Problem: Today, rendering the audit log on dev.coder.com takes over 1 minute for the first page.

When the audit log grows to a significant number of rows (currently 970714 entries at the time of writing for dev.coder.com), the pagination causes it to become slow.

The main culprit is the "total" count (COUNT(audit_logs.*) OVER () AS count) which converts the query from rendering N first results to reading the entire table as the count is based on applied filters.

Simply changing this out for (SELECT COUNT(*) FROM audit_logs) AS count makes the query instant, but of course, incorrect.

Solution: We must figure out a way to optimize the GetAuditLogsOffset query to show results faster.

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

No branches or pull requests

1 participant