FeatureFuel
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"

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests