fix: remove to_plural from postgres connector runtime #1718
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.
I was digging into the binary sizes of the gateway & executor last week. One of the things I noticed was that the regex crate (a known space waster) was being pulled into the executor, so I dug into that. Turns out this was from a single innocent looking call to
Inflector::to_plural
in the postgres connector.So, this works the connector to do that call at deploy time in the postgres-parser instead of at runtime, which should reduce the executor payload by a fair bit.
I've approached this by just storing the singular & plural relation field names against every table and storing that. I'm not 100% happy with this implementation: these are technically only required for tables with relations, and even then a given relation might only need one of the forms. But I'm not familiar enough with the code to figure out the best place to do exactly what we need. Particularly since tables names can change later in the process if their name clashes, so we'd then need to propagate that into our memoised relation names. If anyone knows of a better way to do this (or wants to revisit) feel free.
Part of GB-6697