Guest User

Untitled

a guest
Dec 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. CREATE TABLE data.log
  2. (
  3. id BIGINT GENERATED ALWAYS AS IDENTITY
  4. (
  5. INCREMENT BY 1
  6. MINVALUE -9223372036854775808
  7. MAXVALUE 9223372036854775807
  8. START WITH -9223372036854775808
  9. RESTART WITH -9223372036854775808
  10. CYCLE
  11. ),
  12. epoch_millis BIGINT NOT NULL,
  13. message TEXT NOT NULL
  14.  
  15. ) PARTITION BY RANGE (epoch_millis);
  16.  
  17. CREATE TABLE data.foo_log
  18. PARTITION OF data.log
  19. (
  20. PRIMARY KEY (id)
  21. )
  22. FOR VALUES FROM (0) TO (9999999999);
  23.  
  24. INSERT INTO data.foo_log (epoch_millis, message)
  25. VALUES (1000000, 'hello');
  26.  
  27. INSERT INTO data.log (epoch_millis, message)
  28. VALUES (1000000, 'hello');
  29.  
  30. CREATE TABLE data.foo_log
  31. PARTITION OF data.log
  32. (
  33. id DEFAULT nextval('data.log_id_seq'),
  34. PRIMARY KEY (id)
  35. )
  36. FOR VALUES FROM (0) TO (9999999999);
Add Comment
Please, Sign In to add comment