-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
We may also be able to get a performance improvement for Hollo as a whole by limiting the amount of data we query back from the database on each request. The query in tokenRequired
middleware to set c.get("token")
returns back a tonne of data that's probably unnecessary
like, we probably only need to pull back the accountOwnerId
, accountId
and applicationId
— then if we need the full records, we just query for the record for that id.
At the moment we pull back all this data on every request that has tokenRequired
:
the query plan for that query is complex:
we could probably swap it out with a simpler query, but hit the database more often for some things:
The simpler query doesn't include any of the relationships:
select "accessTokens"."code", "accessTokens"."application_id", "accessTokens"."account_owner_id", "accessTokens"."grant_type", "accessTokens"."scopes", "accessTokens"."created" from "access_tokens" where "accessTokens"."code" = '49yHfVlcAMcJpmmJo314NQ' limit 1;
Maybe we'd want to do a join between account_owner_id
and the accounts
table, idk.