Question

Is there a way to dispatch stored procedure invocation on particular shard, based on sharding key (passed as procedure argument or somehow separately)?

For example we have a table, sharded between 3 nodes using HASH sharding strategy. All rows with key A are stored on node 1. I'd like to be sure that when I run procedure(A), it applies on node1.

We are going to use Mysql Fabric tool, but other options considered as well.

Was it helpful?

Solution

Off the wall...

  1. Turn the Procedure into a function. Simply return 0, or something irrelevant.
  2. Instead of CALLing the Procedure, invoke the Function this way:

    SELECT 0 WHERE key = 'A' AND routine(key);

The hope is that the sharding will kick in for the first part of the WHERE and send the SELECT only to the desired shard.

BTW, it appears that Fabric is being decommissioned.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top