MySQL データ分割入門

4,243 views
4,178 views

Published on

Published in: Lifestyle
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,243
On SlideShare
0
From Embeds
0
Number of Embeds
442
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MySQL データ分割入門

  1. 1. MySQL mysql-casual#1 (2010-12-10) @xaicron2010 12 13
  2. 2. • @xaicron ( ) • works at DeNA • blog http://blog.livedoor.jp/xaicron/2010 12 13
  3. 3. Perl2010 12 13
  4. 4. JPerl Advent Calender2010 12 13
  5. 5. 2010 12 13
  6. 6. http://perl-users.jp/articles/advent-calendar/help.html2010 12 13
  7. 7. 2010 12 13
  8. 8. MySQL2010 12 13
  9. 9. 2010 12 13
  10. 10. 2010 12 13
  11. 11. 2010 12 13
  12. 12. 2010 12 13
  13. 13. myfinder2010 12 13
  14. 14. 2010 12 13
  15. 15. cv.2010 12 13
  16. 16. Agenda • Sharding • Partitioning2010 12 13
  17. 17. Sharding2010 12 13
  18. 18. Sharding • Shared Nothing • DB2010 12 13
  19. 19. user_id2010 12 13
  20. 20. 2010 12 13
  21. 21. Sharding2010 12 13
  22. 22. DB2010 12 13
  23. 23. • • Disk IO •2010 12 13
  24. 24. Sharding2010 12 13
  25. 25. • JOIN • • • orz2010 12 13
  26. 26. 2010 12 13
  27. 27. user_id auto_increment DB2010 12 13
  28. 28. DB2010 12 13
  29. 29. 2010 12 13
  30. 30. • • • •2010 12 13
  31. 31. Partitioning2010 12 13
  32. 32. Partitioning • • SELECT Partition drop • 5.1 --with-partition2010 12 13
  33. 33. 2010 12 13
  34. 34. 2010 12 13
  35. 35. Partitioning2010 12 13
  36. 36. • • Partition • Partition SELECT • SUM() COUNT() •2010 12 13
  37. 37. 2010 12 13
  38. 38. ALTER TABLE table_name DROP PARTITIONS!!2010 12 13
  39. 39. Partition2010 12 13
  40. 40. 2010 12 13
  41. 41. 2010 12 13
  42. 42. SELECT Partition2010 12 13
  43. 43. CREATE TABLE `tweet` ( `id` bigint(20) NOT NULL, `tweet` varchar(140) NOT NULL, `created_on` timestamp NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 PARTITION BY RANGE ( UNIX_TIMESTAMP(created_on) ) ( PARTITION p20101210 VALUE LESS THAN (1291906800), PARTITION p20101211 VALUE LESS THAN (1291993200), PARTITION p20101212 VALUE LESS THAN (1292079600), PARTITION p20101213 VALUE LESS THAN (1292166000), PARTITION p20101214 VALUE LESS THAN (1292252400)2010 12 13
  44. 44. 201012102010 12 13
  45. 45. SELECT * FROM tweet WHERE created_on > ‘20101210’ AND tweet = ‘mysqlcasual’;2010 12 13
  46. 46. p20101210 partition2010 12 13
  47. 47. EXPLAIN PARTITION SELECT ... partition2010 12 13
  48. 48. Partitioning2010 12 13
  49. 49. • PARTITION created_on) KEY ( Primary Key • UNIQ • SELECT • UNIX_TIMESTAMP() v5.1.43 !!2010 12 13
  50. 50. 2010 12 13
  51. 51. • • MySQL • ( cron ) • !!2010 12 13
  52. 52. cv.2010 12 13
  53. 53. Sharding Partitioning2010 12 13
  54. 54. 2010 12 13
  55. 55. 2010 12 13
  56. 56. 2010 12 13
  57. 57. 2010 12 13

×