Created
June 8, 2016 12:26
-
-
Save marcocitus/055255f39618eb141d699ae8819cb1b1 to your computer and use it in GitHub Desktop.
Create range-partitioned shard in Citus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION master_create_range_shard( | |
table_name text, | |
minvalue text, | |
maxvalue text) | |
RETURNS void | |
LANGUAGE plpgsql | |
AS $function$ | |
DECLARE | |
new_shard_id bigint; | |
BEGIN | |
SELECT master_create_empty_shard(table_name) | |
INTO new_shard_id; | |
UPDATE pg_dist_shard | |
SET shardminvalue = minvalue, shardmaxvalue = maxvalue | |
WHERE shardid = new_shard_id; | |
END; | |
$function$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment