Reputation: 23
I'm having some issue with API Plateform performance, against a 35.7 GiB database i'm trying to expose.
I'm using the collection pagination feature, because it is a need. For most of my queries it is working ok because they contains filters limitating the set of results.
Only for the default query (without filter) the count query is taking a very long time (10k seconds). So i was hopping to find some way prevent the pagination to happen in this very case, as i'm not able to prevent this kind of API usages.
I looked into the README, the code and documentation about performance but didn't find a sufficent answer, so i tried overriding the PaginationExtension service:
I rewrote the isPartialPaginationEnabled() method just to replace the first line, but i'm not satisfied with the result.
So i'm asking if there is maybe a way i didn't see, or maybe an other approch to the problem. Any help would be welcome.
Thanks by advance.
Upvotes: 2
Views: 407
Reputation: 413
I don't know if i get you right. But you can disable count query to improve pagination performance, check below my config for this situation.
#api_platform.yaml
collection:
pagination:
client_enabled: true
enabled_parameter_name: 'pagination' # optional
client_items_per_page: true # Disabled by default
items_per_page_parameter_name: itemsPerPage # Default value
partial: true
client_partial: true # Disabled by default
partial_parameter_name: 'partial' # Default value
Upvotes: 2