Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PARTITION BY RANGE (used_at) (
- PARTITION p0 VALUES LESS THAN ('2012-01-01'),
- PARTITION p1 VALUES LESS THAN ('2013-01-01'),
- PARTITION p2 VALUES LESS THAN ('2014-01-01'),
- );
- WHERE used_at >= '2013-05-01' AND used_at < '2013-09-01'
- user (3 000 000 records):
- user_id UNSIGNED INT ...
- ...
- messages (50 000 000 records)
- sender UNSIGNED INT (refers to user)
- recipient UNSIGNED INT (refers to user)
- WHERE ... (sender = 1234567 OR recipient = 1234567)
- ...
- GROUP BY (sender + recipient)
- PARTITION BY RANGE (sender + recipient) (
- PARTITION p0 VALUES LESS THAN (1000000),
- PARTITION p1 VALUES LESS THAN (2000000),
- ...
- PARTITION p5 VALUES LESS THAN (6000000),
- );
- WHERE ... (sender = 1234567 OR recipient = 1234567)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement