Skip to content

Commit fb09052

Browse files
committed
datastore: UNION ALL for mysql list entries query
We have seen high CPU on mysql DB. Optimizing this frequent query should help. This brings the mysql 8 and above that supports WITH clause on par with postgresql. Essentially port #4111 to buildFetchRegistrationEntriesQueryMySQLCTE. Signed-off-by: ztrain <ztrain@uber.com>
1 parent 406735f commit fb09052

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/server/datastore/sqlstore/sqlstore.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,7 +2931,7 @@ FROM
29312931
registered_entries
29322932
WHERE id IN (SELECT id FROM listing)
29332933
2934-
UNION
2934+
UNION ALL
29352935
29362936
SELECT
29372937
F.registered_entry_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, B.trust_domain, NULL, NULL, NULL, NULL, NULL
@@ -2944,15 +2944,15 @@ ON
29442944
WHERE
29452945
F.registered_entry_id IN (SELECT id FROM listing)
29462946
2947-
UNION
2947+
UNION ALL
29482948
29492949
SELECT
29502950
registered_entry_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, id, value, NULL, NULL, NULL
29512951
FROM
29522952
dns_names
29532953
WHERE registered_entry_id IN (SELECT id FROM listing)
29542954
2955-
UNION
2955+
UNION ALL
29562956
29572957
SELECT
29582958
registered_entry_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, id, type, value, NULL, NULL, NULL, NULL, NULL, NULL

0 commit comments

Comments
 (0)