perf(jdbc): add key_subscriptions(subscription_id) index for ApiKey appender warmup (APIM-14263)#17323
Open
wbabyte wants to merge 1 commit into
Open
perf(jdbc): add key_subscriptions(subscription_id) index for ApiKey appender warmup (APIM-14263)#17323wbabyte wants to merge 1 commit into
wbabyte wants to merge 1 commit into
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…ppender warmup (APIM-14263)
1f2c7af to
20bc6ea
Compare
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
aditya-goyal01
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes APIM-14263.
What
Adds a JDBC index
key_subscriptions(subscription_id)(Liquibasev4_11_8/05_…; additive — keeps the existing PK).Why
The gateway-sync ApiKey appender (APIM-14203) loads keys via
select … from keys where id in (select key_id from key_subscriptions where subscription_id in (…chunk…)).key_subscriptions's only index is the PK(key_id, subscription_id)— leading columnkey_id— sowhere subscription_id in (…)cannot use it and Postgres does a Parallel Seq Scan per chunk.At ~2.4M subs / ~800k
key_subscriptionsrows this is ~2.3 s/chunk (EXPLAIN ANALYZE); over thousands of chunks the real-gateway warmup hung >30 min with 0/8109 APIs deployed. The same dataset with no api-keys warms up in ~80 s.Mongo parity
MongoDB already has the equivalent —
keys.{subscriptions:1}(KeysSubscriptionsIndexUpgrader, names1). This PR closes the JDBC↔Mongo parity gap; no Mongo change needed.Notes
(plan,id)index (APIM-14087) already on4.11.x.