Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. PARTITION BY RANGE (used_at) (
  2. PARTITION p0 VALUES LESS THAN ('2012-01-01'),
  3. PARTITION p1 VALUES LESS THAN ('2013-01-01'),
  4. PARTITION p2 VALUES LESS THAN ('2014-01-01'),
  5. );
  6.  
  7. WHERE used_at >= '2013-05-01' AND used_at < '2013-09-01'
  8.  
  9. user (3 000 000 records):
  10. user_id UNSIGNED INT ...
  11. ...
  12.  
  13.  
  14. messages (50 000 000 records)
  15. sender UNSIGNED INT (refers to user)
  16. recipient UNSIGNED INT (refers to user)
  17.  
  18. WHERE ... (sender = 1234567 OR recipient = 1234567)
  19. ...
  20. GROUP BY (sender + recipient)
  21.  
  22. PARTITION BY RANGE (sender + recipient) (
  23. PARTITION p0 VALUES LESS THAN (1000000),
  24. PARTITION p1 VALUES LESS THAN (2000000),
  25. ...
  26. PARTITION p5 VALUES LESS THAN (6000000),
  27. );
  28.  
  29. WHERE ... (sender = 1234567 OR recipient = 1234567)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement