Pick partial index for services query for instance and template level
What does this MR do?
This is supposed to fix a database query that was causing about 40% of total workload on each of the database replicas for GitLab.com.
The fix makes sure we can pick the partial index (which exists solely for this purpose, I believe).
The logic doesn't change:
# SELECT * FROM (VALUES (false), (true), (null)) AS t (a) WHERE a = true;
a
---
t
(1 row)
# SELECT * FROM (VALUES (false), (true), (null)) AS t (a) WHERE a is true;
a
---
t
(1 row)
For illustration:
# SELECT a = true, a is true FROM (VALUES (false), (true), (null)) AS t (a);
?column? | ?column?
----------+----------
f | f
t | t
| f
(3 rows)
Does this MR meet the acceptance criteria?
Conformity
Edited by 🤖 GitLab Bot 🤖