Skip to content

Conversation

@jfg956
Copy link

@jfg956 jfg956 commented Jan 19, 2026

When running ps-top on an instance with general log enabled, I see the three (3) queries below being executed every second.

2026-01-19T19:14:20.894785-00:00          187 Prepare   SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME = ?
2026-01-19T19:14:20.894842-00:00          187 Execute   SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Uptime'
2026-01-19T19:14:20.895481-00:00          187 Close stmt

I trace this down to below:

In the grand scheme of things, running these 3 queries every second is not such a problem as the associated load on the database is probably negligible. On the other hand, this increases the number of queries needed every second by ps-top from 1 to 4, being 75% of the total number of queries run every second by ps-top. Moreover, these are not needed, as querying Uptime once should be enough to compute it client-side.

This PR removes the need for these 3 queries every second, querying Uptime only once, and then computing it client side.

@jfg956 jfg956 marked this pull request as ready for review January 19, 2026 19: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.

1 participant