Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: make sure all foreign keys have an index #143

Open
dargmuesli opened this issue Feb 2, 2025 · 0 comments
Open

perf: make sure all foreign keys have an index #143

dargmuesli opened this issue Feb 2, 2025 · 0 comments
Labels
good first issue Good for newcomers hacktoberfest Recommendation for work that qualifies for hacktoberfest approvals technical Not a feature nor a bug

Comments

@dargmuesli
Copy link
Member

dargmuesli commented Feb 2, 2025

making a column a reference to a foreign key does not add an index to that column, so for example User.postsByAuthorId will be slow unless you've manually added an index to posts.author_id

from https://www.graphile.org/postgraphile/performance/, see https://www.graphile.org/postgraphile/postgresql-indexes/#advice---foreign-key-indexes too.

So all such columns should have an index. The index migrations could be merged into the table definitions.

@dargmuesli dargmuesli added the technical Not a feature nor a bug label Feb 2, 2025
@dargmuesli dargmuesli added this to maevsi Feb 2, 2025
@dargmuesli dargmuesli moved this to 🔖 Ready in maevsi Feb 2, 2025
@dargmuesli dargmuesli added good first issue Good for newcomers hacktoberfest Recommendation for work that qualifies for hacktoberfest approvals labels Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest Recommendation for work that qualifies for hacktoberfest approvals technical Not a feature nor a bug
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant