Bug #15932 why can't indexes updated?
| Submitted: | 22 Dec 2005 9:31 | Modified: | 22 Jan 2006 13:41 |
|---|---|---|---|
| Reporter: | zhenxing zhai | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.17 | OS: | Linux (linux) |
| Assigned to: | CPU Architecture: | Any |
[22 Dec 2005 9:31]
zhenxing zhai
[22 Dec 2005 13:41]
Valeriy Kravchuk
Thank you for a problem report. Looks like non-unique indexes are not always updated during
insert into weblogentry_new select * from weblogentry;
because of the same bulk-insert optimization that is performed for LOAD DATA INFILE... I am looking for the description to give you the URL.
Please, try to perform ANALYZE TABLE weblogentry_new after INSERT ... SELECT... Your indexes information should become correct after that.
The problem can be demonstrated using only one table:
mysql> create table t1 (c1 int auto_increment primary key, c2 char(10), key c2_k
ey (c2)) engine = MyISAM;
Query OK, 0 rows affected (0.05 sec)
mysql> insert into t1(c2) values ('aaa');
Query OK, 1 row affected (0.03 sec)
mysql> insert into t1(c2) values ('aaa');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1(c2) values ('aaa');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1(c2) values ('bbb');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1(c2) select c2 from t1;
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> insert into t1(c2) select c2 from t1;
Query OK, 8 rows affected (0.00 sec)
Records: 8 Duplicates: 0 Warnings: 0
mysql> insert into t1(c2) select c2 from t1;
Query OK, 16 rows affected (0.01 sec)
Records: 16 Duplicates: 0 Warnings: 0
mysql> insert into t1(c2) select c2 from t1;
Query OK, 32 rows affected (0.01 sec)
Records: 32 Duplicates: 0 Warnings: 0
mysql> insert into t1(c2) select c2 from t1;
Query OK, 64 rows affected (0.02 sec)
Records: 64 Duplicates: 0 Warnings: 0
mysql> insert into t1(c2) select c2 from t1;
Query OK, 128 rows affected (0.02 sec)
Records: 128 Duplicates: 0 Warnings: 0
mysql> show index from t1;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| t1 | 0 | PRIMARY | 1 | c1 | A | 256 | NULL | NULL | | BTREE | |
| t1 | 1 | c2_key | 1 | c2 | A | NULL | NULL | NULL | YES | BTREE | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
2 rows in set (0.00 sec)
mysql> analyze table t1;
+---------+---------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+---------+----------+----------+
| test.t1 | analyze | status | OK |
+---------+---------+----------+----------+
1 row in set (0.00 sec)
mysql> show index from t1;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| t1 | 0 | PRIMARY | 1 | c1 | A | 256 | NULL | NULL | | BTREE | |
| t1 | 1 | c2_key | 1 | c2 | A | 2 | NULL | NULL | YES | BTREE | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
2 rows in set (0.00 sec)
[23 Jan 2006 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.