beowulf1416

Untitled

Dec 9th, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. -- recreate log_mpe table
  2. create table log_mpe_2 like log_mpe;
  3.  
  4. -- determine new auto_increment value for new table
  5. select max(id) + 5000
  6. from log_mpe;
  7.  
  8. alter table log_mpe_2
  9. auto_increment ##max_id##;
  10.  
  11. -- rename table, subsequent inserts will go to new log_mpe table
  12. -- and use the next higher id
  13. rename table log_mpe to log_mpe_old, log_mpe_2 to log_mpe;
  14.  
  15. -- insert 1 hours worth or records from original log_mpe table
  16. insert into log_mpe
  17. select *
  18. from log_mpe_old lo
  19. where creation_timestamp > date_sub(now(), interval 1 hour);
Advertisement
Add Comment
Please, Sign In to add comment