Skip to content

Increase in time for primary key lookup on projects table

As part of #895 (closed) we observed an increase in query times for a simple primary key lookup. It goes up to a maximum of 3s, mean is at 0.3ms with a stddev of 14ms.

gitlabhq_production=# select * from pg_stat_statements where queryid=3046840721;
-[ RECORD 1 ]-------+-----------------------------------------------------------------------
userid              | 16384
dbid                | 16385
queryid             | 3046840721
query               | SELECT  "projects".* FROM "projects" WHERE "projects"."id" = ? LIMIT ?
calls               | 454786
total_time          | 139120.22499997
min_time            | 0.014
max_time            | 3033.834
mean_time           | 0.305902611338076
stddev_time         | 14.2026285511305
rows                | 454766
shared_blks_hit     | 2059814
shared_blks_read    | 8
shared_blks_dirtied | 41
shared_blks_written | 0
local_blks_hit      | 0
local_blks_read     | 0
local_blks_dirtied  | 0
local_blks_written  | 0
temp_blks_read      | 0
temp_blks_written   | 0
blk_read_time       | 0.163
blk_write_time      | 0

This data was gathered about 10 minutes after resetting pg_stat_statements.

We should investigate where that comes from and if that is something new.

Edited by Andreas Brandl