-
Notifications
You must be signed in to change notification settings - Fork 163
first/last, before/after support #21
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
Comments
graphql/graphql-relay-js package actually supports this with their default result parsing feature. I really think that trying to add native postgres query support for this would just result in a slower operation then what is being done already. Added tests for all the mentioned arguments to show it working. |
Haven't looked at the relay code yet, but i assume it does filtering after the values have been loaded from the database? |
yeah, the filtering is done on the result level - not prior to the data being queried. We'd have to do a deeper integration which we will most definitely want to implement at some point for application speed. Before After also uses a cursor for record parsing so we'd need to really look into how that cursor is generated and apply that our code. This will be an optimization level feature for our project so it might be a bit before we get to it. |
I'll likely need it for my project since querying the entire range would be very expensive. |
So there's some talk about constructing your own cursors and storing data in them. |
We'll probably need custom logic for all this, and won't be able to use /cc @aweary @brad-decker |
It would be great to support the Relay connection args out of the box for users.
first
/last
would simply require the user to select what field to order on.before
/after
is a little more tricky, we can't simply do a comparison on ID since the order might be on something that doesn't align with the ID.We might need to do something like
[field] > (SELECT [field] FROM [table] WHERE id = [after] LIMIT 1)
which might kill performance slightly./cc @brad-decker
The text was updated successfully, but these errors were encountered: