Skip to content

Instantly share code, notes, and snippets.

@terhechte
Created January 25, 2014 15:21
Show Gist options
  • Save terhechte/8617960 to your computer and use it in GitHub Desktop.
Save terhechte/8617960 to your computer and use it in GitHub Desktop.
postgresql url partition scheme setup
CREATE TABLE urls_s (CHECK (ascii(url) in (115))) INHERITS (urls);
CREATE TABLE urls_ak (CHECK (ascii(url) in (97, 107))) INHERITS (urls);
CREATE TABLE urls_bl (CHECK (ascii(url) in (98, 108))) INHERITS (urls);
CREATE TABLE urls_cj (CHECK (ascii(url) in (99, 106))) INHERITS (urls);
CREATE TABLE urls_de (CHECK (ascii(url) in (100, 101))) INHERITS (urls);
CREATE TABLE urls_fg (CHECK (ascii(url) in (102, 103))) INHERITS (urls);
CREATE TABLE urls_hiv (CHECK (ascii(url) in (104, 105, 118))) INHERITS (urls);
CREATE TABLE urls_mr (CHECK (ascii(url) in (109, 114))) INHERITS (urls);
CREATE TABLE urls_np (CHECK (ascii(url) in (110, 112))) INHERITS (urls);
CREATE TABLE urls_txzyo (CHECK (ascii(url) in (116, 120, 122, 121, 111))) INHERITS (urls);
CREATE TABLE urls_uw0123456789q (CHECK (ascii(url) in (117, 119, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113))) INHERITS (urls);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment