Guest User

Untitled

a guest
Jul 31st, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. // user_actions
  2. auto_id = auto increment ID
  3. type = a number (1 = photo upload, 2 = friend added, 3 = status post, 4 = so other action, etc..)
  4. user_id = The id of the user who did the action
  5. datetime = date and time
  6. action_id = this could be the ID of the action, so if it is for a status post, it could be the ID of the actual status post record
  7.  
  8. CREATE TABLE user_actions (
  9. auto_id INT NOT NULL AUTO_INCREMENT,
  10. type INT NOT NULL,
  11. user_id INT NOT NULL,
  12. insert_datetime DATE NOT NULL,
  13. action_id INT NOT NULL)
  14. PARTITION BY RANGE(TO_DAYS(insert_datetime))
  15. (
  16. PARTITION p0 VALUES LESS THAN (to_days('2011-06-01')),
  17. PARTITION p1 VALUES LESS THAN (to_days('2012-01-01')) ,
  18. PARTITION p11 VALUES LESS THAN MAXVALUE
  19. );
  20.  
  21. -- Untested, but again should be close
  22. ALTER TABLE t1 REORGANIZE PARTITION (pM) INTO
  23. (PARTITION p20110101 VALUES LESS THAN (to_days('2011-07-01'),
  24. PARTITION pM VALUES LESS THAN MAXVALUE);
Advertisement
Add Comment
Please, Sign In to add comment