The pop_basis table is our largest table, and counts on it take significantly longer than other tables. Luckily we do not use counts on this table in our application code. But we do with l2_keystones, so if l2_keystones ever got into a similar state then counts would take too long.
Find out why counts are taking so long on pop_basis is it size? etc.
Confirmation
Describe the bug
The
pop_basis
table is our largest table, and counts on it take significantly longer than other tables. Luckily we do not use counts on this table in our application code. But we do withl2_keystones
, so ifl2_keystones
ever got into a similar state then counts would take too long.Find out why counts are taking so long on
pop_basis
is it size? etc.Expected behaviour
Counts on
pop_basis
should seem instant.Environment
Version: Operating System: Architecture:
Additional Information
Here are the query plans for one of our replicas
this could be due to parallel aggregation https://www.postgresql.org/docs/current/parallel-plans.html#PARALLEL-AGGREGATION