Skip to content

Query performance "Select 1"

On checkup PostgreSQL (https://gitlab.com/gitlab-com/gl-infra/infrastructure/snippets/1975379#postgres-checkup_K003 ) we have the following info :

Screenshot_2020-05-28_at_10.45.21

That represents this query it's being executed almost 4k per second and represents 49% of all queries, which increases our kernel context switching.

After investigating spikes over 70% of CPU usage on the database:

Link to reports/investigations

we find out this statement being executed thousands of times: SELECT 1

Implementation Issue

We're working on an implementation issue here #292749 (closed) to replace select 1 with an empty string

Edited by Craig Gomes