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
Returing N rows with no relations generates N superfluous selects #65
Comments
Hi, These individual selects are executed by sqlalchemy Do you have performance problems because of this? When working with really large datasets, doing a |
That seems odd, but I will try to reproduce it with sqlalchemy. The strange thing is that the requested data is all returned in the initial query while the repeated SELECT items.id = '' LIMIT 1 OFFSET 0 does not return anything and seemingly serves no purpose (it scales badly on hundreds of rows). |
I'll investigate some more when I find some time, I'm not that familiar with sqla internals and debuggging and this is quite complicated. |
Thanks, I will also have a look and see if I can isolate the underlying issue |
You are absolutely right that this is due to the sqlalchemy internals. the .all() triggers the selects regardless of paging. Closing this and rewriting the usage to get around performance issues for larger resultsets. |
If you have perf problems on the front, maybe you can perform simultaneous requests with a different offset and smaller limit. |
I decided to go for jsonapi_rpc and implement using handmade sql in this case. |
It's poorly documented, but it is possible to have jsonapi_rpc or filter= return a jsonapi formatted response object if you wish. |
Hi,
I stumbled upon this issue recently while returning larger datasets.
When doing a trivial select on tables with no relations, after the correctly formatted select returning N rows, N more selects with seemingly no cause are executed.
The trivial example below demonstrates this
Executing this query returning 10 rows
/items/?fields%5BItem%5D=foo%2Cbar&page%5Boffset%5D=0&filter%5Bbar%5D=group_0
results in 10 instances of:
Code for reproduction:
The text was updated successfully, but these errors were encountered: