Bug #15095 | Duplicates Error | ||
---|---|---|---|
Submitted: | 21 Nov 2005 11:53 | Modified: | 22 Nov 2005 17:21 |
Reporter: | hello world | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 5.0 | OS: | Windows (Winxp) |
Assigned to: | CPU Architecture: | Any |
[21 Nov 2005 11:53]
hello world
[22 Nov 2005 1:13]
Hartmut Holzgraefe
what exactly are you trying to accomplish here? as far as i understand the rows in your table are all unique and you have 30405 rows with cdrid=20051116 now you add an unique index on the first 7 fields a,b,cd,ef,gh,ij,kl and as you chose to use ALTER IGNORE all rows with duplicate values *in this group of fields* are removed, which is expected and documented behavior: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html IGNORE is a MySQL extension to standard SQL. It controls how ALTER TABLE works if there are duplicates on unique keys in the new table or if warnings occur when STRICT mode is enabled. If IGNORE is not specified, the copy is aborted and rolled back if duplicate-key errors occur. If IGNORE is specified, then for rows with duplicates on a unique key, only the first row is used. The others conflicting rows are deleted. Wrong values are truncated to the closest matching acceptable value.
[22 Nov 2005 7:49]
hello world
thinking a call records, the file has 30405 rows , all are 100% unique rows with call records. example: Date, Time, Pin, Destno = in a specific time , you are calling from a telephone number to a destination number. now i have a unique (date,time,pin,destno) index. after inserting all i see 29564 rows inserted. doesnt it mean mysql unique (date,time,pin,destno) not working for me ? i hope you understand.
[22 Nov 2005 8:30]
hello world
/************************** You are right, this is not bug. /************************** i am sorry, this is my fault, i have to find the unique combination from that rows. by the way how many fields i can make uniqe ? maximum
[22 Nov 2005 17:21]
Valeriy Kravchuk
Closed because it is not a bug, but a reprter fault. As for "how many fields i can make uniqe ? maximum", please, read the manual (http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html, for example). You need unique index, and index may have up to 15 columns. But there are some total key lenth limitations also.