4
Add `count_estimate` to `directus_collections`
Source: directus/directus#24881 · opened by @rijkvanzanten
Right now, the app heavily relies on getting the count of a given table for pagination purposes. Especially in Postgres, the bigger the table gets the longer it takes to get this count.
I think we can optimize this by keeping a count_estimate integer on directus_collections that we update with the real number based on count(*) every X time (1h?) with estimated changes based on create/delete events in between. That way, we can optimize the app by fetching the estimate count first (which would be very fast / lightweight) and only fetching the real count if we know that the estimated amount is less than a given threshold where we know the fetching should be quick.
For example:
• Fetch estimate
• If estimate is > 1,000,000, render as "1-25 of ~1,200,000"
• If estimate is <= 1,000,000, fetch exact count and render "1-25 of 261,609"
I think we can optimize this by keeping a count_estimate integer on directus_collections that we update with the real number based on count(*) every X time (1h?) with estimated changes based on create/delete events in between. That way, we can optimize the app by fetching the estimate count first (which would be very fast / lightweight) and only fetching the real count if we know that the estimated amount is less than a given threshold where we know the fetching should be quick.
For example:
• Fetch estimate
• If estimate is > 1,000,000, render as "1-25 of ~1,200,000"
• If estimate is <= 1,000,000, fetch exact count and render "1-25 of 261,609"
No pledges yet. Be the first to back this.
Comments
Similar requests
Possibilty to translate dashboard and panel names
18 votes · 0 comments
Export to file library behaviour does not match 'download file' behaviour
1 vote · 0 comments
Unable to Duplicate Collections with Field Configurations
2 votes · 0 comments
WYSIWYG "Add/Edit Link" function allows linking to directus files
57 votes · 0 comments
Additional Form/Field Layout Options
45 votes · 0 comments
No comments yet.