allnetru/laravel-sharding
A Laravel package for horizontal database sharding. Route queries and Eloquent models across multiple database connections by shard key, manage sharded migrations, and scale large datasets while keeping a familiar Laravel workflow.
distinct(), grouped, and having aggregates work when the query genuinely reads a single shard. This directly supports per-tenant dashboards, unique-entity counts, and grouped reporting without application-level workarounds or false “cannot be combined across shards” failures.avg() on grouped keyed queries—reducing the need to build custom routing and aggregation logic around sharded Laravel models.pin_by_key is off. That makes rollout planning more predictable for teams moving from single-database to keyed sharding.avg() whole from its shard, instead of as a sum and count from two queries, avoids incorrect results on grouped queries where the two queries may not resolve to the same group.user_id, tenant ID, or account ID—and you want framework-level query routing rather than hand-rolled shard selection.distinct()->count(), grouped counts, having, or avg() within a single shard, and you want those queries to succeed rather than be refused unnecessarily.pin_by_key.For executives: v0.6.4 is a correctness and reliability fix for sharded Laravel queries. It removes false failures for keyed aggregate queries—such as per-tenant distinct counts and grouped reporting—and fixes an avg() edge case on grouped keyed queries. This reduces production incidents and support burden while making sharding more viable for customer-facing analytics.
For engineering: The release refines aggregate refusal logic to use the same readsOneShard() check as raw aggregates. A keyed query that reads one shard can now answer distinct(), grouped, and having aggregates locally; unkeyed queries remain refused, and keyed queries during rebalance remain refused when pin_by_key is off and the query fans out again. Keyed avg() is taken whole from its shard rather than split into sum/count queries, avoiding incorrect grouped results. No breaking changes are indicated; this is an adoption-confidence update rather than a new feature release.
How can I help you explore Laravel packages today?