[Á°][¼¡][ÈÖ¹æ½ç°ìÍ÷][¥¹¥ì¥Ã¥É°ìÍ÷]

mysql:11846

From: "T.Sasaki" <"T.Sasaki" <papasan2000@xxxxxxxxxx>>
Date: 1 Aug 2005 16:28:37 +0900
Subject: [mysql 11846] Re: DELETE FROM table_name; ¤Ç AUTO_INCREMENT Ãͤ¬½é´ü²½¤µ¤ì¤Ê¤¤

º´¡¹ÌڤǤ¹¡£

°ì¤Ä¤Î¼êÃʤȤ·¤Æ¡¢¥Æ¡¼¥Ö¥ë¥í¥Ã¥¯¤Ç¤Ï¤Ê¤¯¡¢
¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥ì¥Ù¥ë¤Î¥í¥Ã¥¯µ¡Ç½¤òÍøÍѤ¹¤ëÊýË¡¤¬¤¢¤ê¤Þ¤¹¡£

Îã¡Ë
¡¡SELECT get_lock( 'lock1', 30 );
¡¡DELETE FROM from table_name;
¡¡ALTER TABLE table_name AUTO_INCREMENT = 1;
¡¡SELECT release_lock( 'lock1' );

¾°¡¢DELETE ¤Ç¤Ï¤Ê¤¯¡¢TRUNCATE TABLE ¤òÍѤ¤¤ÆÁ´¥ì¥³¡¼¥É¤ò
ºï½ü¤¹¤ë¤È¡¢AUTO_INCREMENT ¤ÎÃͤ¬½é´üÃÍ(1)¤ËÌá¤ë¤è¤¦¤Ç¤¹¡£

¾åµ­¤Ï MySQL 4.1.12 ¤È 5.0.7 ¤Î MyISAM ¥Æ¡¼¥Ö¥ë¤Ç³Îǧ¤·¤Þ¤·¤¿¡£
¥Þ¥Ë¥å¥¢¥ë¤Îµ­½Ò¤Ë´Ø¤·¤Æ¤Ï²¿¤È¤â¤¤¤¨¤Þ¤»¤ó¡£


"Tetsuya Hirotsu" <hirotsu@xxxxxxxxxx> wrote:
> ¤ªÀ¤Ïäˤʤê¤Þ¤¹¡¢¹­ÄŤȿ½¤·¤Þ¤¹¡£
> 
> 
> AUTO_INCREMENT ¥«¥é¥à¤ò»ý¤Ä¥Æ¡¼¥Ö¥ë¤Î¥í¥Ã¥¯Ãæ¤Ë¡¢¤½¤Î¥Æ¡¼¥Ö¥ë¤«¤é
> Á´¥ì¥³¡¼¥É¤òºï½ü¸å¡¢¤Û¤ÜƱ¤¸¿ô¤Î¥ì¥³¡¼¥É¤ò INSERT ¤¹¤ë¤È¤¤¤¦½èÍý¤¬¤¢¤ê¤Þ¤¹¡£
> ¤³¤Î¤È¤­¡¢INSERT ¤¹¤ë¥ì¥³¡¼¥É¤Î AUTO_INCREMENTÃͤò 1 ¤«¤é»Ï¤á¤µ¤»¤¿¤¤¤Î¤Ç¤¹¤¬¡¢
> ¤¦¤Þ¤¯¤¤¤­¤Þ¤»¤ó¡£
> 
> 
> 5.0.6-beta ¤Î¥Þ¥Ë¥å¥¢¥ë¡Êhttp://dev.mysql.com/doc/mysql/ja/index.html¡Ë¤Ë
> 
> ¡ä6.5.3. CREATE TABLE ¹½Ê¸
> ¡äAUTO_INCREMENT ¥«¥é¥à¤ÎºÇÂçÃͤ¬Æþ¤Ã¤¿¥ì¥³¡¼¥É¤òºï½ü¤·¤¿¾ì¹ç¡¢¤½¤ÎÃÍ¤Ï ISAM ¥Æ¡¼¥Ö¥ë¤ä BDB ¥Æ¡¼¥Ö¥ë¤Ç¤ÏºÆÍøÍѤµ¤ì¤ë¤¬¡¢
> ¡äMyISAM ¥Æ¡¼¥Ö¥ë¤ä InnoDB ¥Æ¡¼¥Ö¥ë¤Ç¤ÏºÆÍøÍѤµ¤ì¤Ê¤¤¡£
> ¡äDELETE FROM table_name¡ÊWHERE Àá¤Ê¤·¡Ë¤ò AUTOCOMMIT ¥â¡¼¥É¤Ç¼Â¹Ô¤·¤Æ¥Æ¡¼¥Ö¥ëÆâ¤Î¤¹¤Ù¤Æ¤Î¥ì¥³¡¼¥É¤òºï½ü¤·¤¿¾ì¹ç¡¢
> ¡äInnoDB ¤ò½ü¤¯¤¹¤Ù¤Æ¤Î¥Æ¡¼¥Ö¥ë·¿¤Ç¡¢Ï¢Â³Ãͤ¬½é¤á¤«¤é³«»Ï¤µ¤ì¤ë¡£
> 
> ¤È¤¢¤ê¤Þ¤¹¤¬¡¢ÅöÊý¤Î´Ä¶­¤Ç¤Ï¡¢DELETE FROM table_name; ¤Î¾ì¹ç¤â¡¢½é´ü²½¤µ¤ì¤º¤Ëºï½üÁ°¤Î
> AUTO_INCREMENT ¥«¥é¥àÃÍ + 1 ¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
> ¤â¤Á¤í¤ó AUTOCOMMIT = 1 ¤Ç¤¹¡£
> 
> ¥µ¡¼¥Ð¡¼    WindowsXP
> MySQL      4.1.3b-beta-nt¡Ê¥Ð¥¤¥Ê¥ê¡Ë
> 
> ¥í¡¼¥«¥ë¤Î Windows ¥Þ¥·¥ó¤«¤é¡¢MySQL ODBC 3.51 + VBA¡¢¤ª¤è¤Ó¡¢
> MySQL ODBC 3.51 + MySQL Query Browser 1.1.0 gamma ¤Ç¾åµ­·ë²Ì¤Ç¤·¤¿¡£
> ¥Ð¡¼¥¸¥ç¥ó 4 ¤Ç¤Ï½ÐÍè¤Ê¤¤¤Î¤Ç¤·¤ç¤¦¤«¡©
> 
> 
> ALTER TABLE table_name AUTO_INCREMENT = 0; ¤ò¼Â¹Ô¤¹¤ë¤È¡¢¤½¤Î¼¡¤«¤é¤Ï½é´ü²½¤µ¤ì¤Þ¤¹¤¬¡¢
> LOCK Ãæ¤Î¥Æ¡¼¥Ö¥ë¤Î¤¿¤á¡¢ALTER ¤Ç¤­¤Þ¤»¤ó¡£
> ¡ÊALTER ¸å¤Î¥Æ¡¼¥Ö¥ë¤¬ÈóLOCK¾õÂ֤ˤʤ롡¢«¡¡¤³¤ì¤ò²óÈò¤¹¤ëÊýË¡¤¬¤¢¤ê¤Þ¤·¤¿¤é¡¢¤³¤ì¤Ç¤âÎɤ¤¤Î¤Ç¤¹¤¬¡¢¡¢¡¢¡Ë
> 
> 
> ¤É¤Ê¤¿¤«¾ðÊó¤ò¤ª»ý¤Á¤ÎÊý¤Ï¤¤¤é¤Ã¤·¤ã¤é¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡© 
> 
> 
> 
> 

[Á°][¼¡][ÈÖ¹æ½ç°ìÍ÷][¥¹¥ì¥Ã¥É°ìÍ÷]

     11815 2005-07-29 12:29 [H M <hassy_94@xxxxxx] ³°Éô¥¯¥é¥¤¥¢¥ó¥È¤«¤é¤ÎÀܳ              
     11816 2005-07-29 14:17 ¨²["T.Sasaki" <papasan2]                                       
     11818 2005-07-29 15:41 ¨­¨±[H M <hassy_94@xxxxxx]                                     
     11820 2005-07-29 16:15 ¨­¡¡¨²["T.Sasaki" <papasan2]                                   
     11822 2005-07-29 16:29 ¨­¡¡¨­¨²[H M <hassy_94@xxxxxx]                                 
     11824 2005-07-29 16:37 ¨­¡¡¨­¨­¨±["T.Sasaki" <papasan2]                               
     11825 2005-07-29 16:35 ¨­¡¡¨­¨±[±óÆ£ ½Ó͵ <endo@xxxx]                                 
     11826 2005-07-29 16:39 ¨­¡¡¨­¡¡¨²[±óÆ£ ½Ó͵ <endo@xxxx]                               
     11827 2005-07-29 16:54 ¨­¡¡¨­¡¡¨±["T.Sasaki" <papasan2]                               
     11830 2005-07-29 18:19 ¨­¡¡¨­¡¡¡¡¨±[±óÆ£ ½Ó͵ <endo@xxxx]                             
     11831 2005-07-29 19:00 ¨­¡¡¨­¡¡¡¡¡¡¨±["T.Sasaki" <papasan2]                           
     11821 2005-07-29 16:17 ¨­¡¡¨±[toki <toki@xxxxxxxxx]                                   
     11823 2005-07-29 16:32 ¨­¡¡¡¡¨±["T.Sasaki" <papasan2]                                 
     11817 2005-07-29 14:25 ¨²[SUGIMURA Takashi ¿ùÂ]                                       
     11819 2005-07-29 16:06 ¨­¨±[H M <hassy_94@xxxxxx]                                     
     11828 2005-07-29 17:03 ¨²[SATOH Fumiyasu <fumi]                                       
     11829 2005-07-29 18:16 ¨­¨±[±óÆ£ ½Ó͵ <endo@xxxx]                                     
     11832 2005-07-29 23:00 ¨±[seidai hirota <seida]                                       
     11833 2005-07-30 15:25 ¡¡¨±[H M <hassy_94@xxxxxx] Ä´ºº·ë²Ì                            
     11834 2005-07-30 22:59 ¡¡¡¡¨²[tateyan <tateyan@xxx]                                   
     11835 2005-07-31 14:56 ¡¡¡¡¨±["T.Sasaki" <papasan2]                                   
     11836 2005-07-31 20:03 ¡¡¡¡¡¡¨±[H M <hassy_94@xxxxxx]                                 
     11837 2005-07-31 20:09 ¡¡¡¡¡¡¡¡¨±[Kazuhiro Yoshida <mo]                               
     11838 2005-07-31 20:16 ¡¡¡¡¡¡¡¡¡¡¨²[H M <hassy_94@xxxxxx]                             
     11840 2005-07-31 20:47 ¡¡¡¡¡¡¡¡¡¡¨­¨²["T.Sasaki" <papasan2]                           
     11841 2005-07-31 22:15 ¡¡¡¡¡¡¡¡¡¡¨­¨±[iida_yuichi <y_iida@]                           
     11842 2005-08-01 09:05 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨²["T.Sasaki" <papasan2]                         
     11853 2005-08-01 20:55 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¨²[iida_yuichi <y_iida@]                       
     11854 2005-08-01 21:50 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¨±[H M <hassy_94@xxxxxx]                       
     11858 2005-08-02 12:33 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¨±["T.Sasaki" <papasan2]                     
     11865 2005-08-02 22:55 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¨±[H M <hassy_94@xxxxxx]                   
     11868 2005-08-03 09:47 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¨±[toki <toki@xxxxxxxxx]                 
     11870 2005-08-03 10:03 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¨±["T.Sasaki" <papasan2]               
     11872 2005-08-03 10:51 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¡¡¨±[<numata@xxxxxxxxxx> ]             
     11873 2005-08-03 11:05 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¡¡¡¡¨±["T.Sasaki" <papasan2]           
     11874 2005-08-03 15:00 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¡¡¡¡¡¡¨±["T.Sasaki" <papasan2]         
     11875 2005-08-03 16:10 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¨²["T.Sasaki" <papasan2]       
     11877 2005-08-03 18:16 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¨­¨±[H M <hassy_94@xxxxxx]     
     11876 2005-08-03 17:00 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨­¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¨±["Kenichiro Fuji" <k_]       
     11843 2005-08-01 15:48 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¨±["Tetsuya Hirotsu" <h] DELETE FROM table_name;  ¤Ç AUTO_INCREMENT  Ãͤ¬½é´ü²½¤µ¤ì¤Ê¤¤
     11844 2005-08-01 15:58 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¡¡¨²["Tetsuya Hirotsu" <h]                       
     11845 2005-08-01 16:24 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¡¡¨²[KIshii <kn-ishi@xxxx]                       
->   11846 2005-08-01 16:28 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¡¡¨±["T.Sasaki" <papasan2]                       
     11856 2005-08-02 11:19 ¡¡¡¡¡¡¡¡¡¡¨­¡¡¡¡¡¡¨±["Tetsuya Hirotsu" <h]                     
     11839 2005-07-31 20:27 ¡¡¡¡¡¡¡¡¡¡¨±[H M <hassy_94@xxxxxx]