You are here

INDEX ISSUE in MYSQL

Dear Team, I have created a index in product table, index name is 'product_id_FK". Currently in that table 35000 records in available. While updating records its taking 1800 seconds to update the records and some time throwing error " lock wait time out excedeed. I kept innodb lock wait time out to 1800. I found that index is not using, kindly analyze from your end and help me. Please find the below details mysql> show index from trackfield_table; +------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+-- ------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | P acked | Null | Index_type | Comment | Index_comment | +------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+-- ------+------+------------+---------+---------------+ | trackfield_table | 0 | PRIMARY | 1 | trackfield_id | A | 35297 | NULL | N ULL | | BTREE | | | | trackfield_table | 1 | brand_FK | 1 | brand_id | A | 10 | NULL | N ULL | YES | BTREE | | | | trackfield_table | 1 | assign_FK | 1 | assignee_id | A | 39 | NULL | N ULL | YES | BTREE | | | | trackfield_table | 1 | VillageCode | 1 | village_code | A | 17648 | NULL | N ULL | | BTREE | | | | trackfield_table | 1 | VillageCode | 2 | state_code | A | 17648 | NULL | N ULL | | BTREE | | | | trackfield_table | 1 | advt_type_idx | 1 | advt_type | A | 2 | NULL | N ULL | YES | BTREE | | | | trackfield_table | 1 | track_id_FK | 1 | track_id | A | 35297 | NULL | N ULL | | BTREE | | | +------------------+------------+---------------+--------------+---------------+-----------+-------------+----------+-- ------+------+------------+---------+---------------+ 7 rows in set (0.03 sec) mysql> explain select recce_done from trackfield_table where track_id = 25.73955998120946; +----+-------------+------------------+------+---------------+------+---------+------+-------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------------+------+---------------+------+---------+------+-------+-------------+ | 1 | SIMPLE | trackfield_table | ALL | track_id_FK | NULL | NULL | NULL | 35297 | Using where | +----+-------------+------------------+------+---------------+------+---------+------+-------+-------------+ 1 row in set (0.00 sec) mysql> mysql> mysql> mysql> explain extended select recce_done from trackfield_table where track_id = 25.73955998120946; +----+-------------+------------------+------+---------------+------+---------+------+-------+----------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+------------------+------+---------------+------+---------+------+-------+----------+-------------+ | 1 | SIMPLE | trackfield_table | ALL | track_id_FK | NULL | NULL | NULL | 35297 | 100.00 | Using where | +----+-------------+------------------+------+---------------+------+---------+------+-------+----------+-------------+ 1 row in set, 1 warning (0.02 sec) mysql> mysql> show warnings; +-------+------+------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------+ | Level | Code | Message | +-------+------+------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------+ | Note | 1003 | select `wp_schema`.`trackfield_table`.`recce_done` AS `recce_done` from `wp_schema`.`trackfield_table` where (`wp_schema`.`trackfield_table`.`track_id` = 25.73955998120946) | +-------+------+------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> mysql> mysql> mysql> explain select recce_done from trackfield_table force(track_id_FX) where track_id = 25.73955998120946; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versio n for the right syntax to use near '(track_id_FX) where track_id = 25.73955998120946' at line 1 mysql> mysql> mysql> mysql> mysql> explain select recce_done from trackfield_table force index (track_id_FX) where track_id = 25.73955998120946; ERROR 1176 (42000): Key 'track_id_FX' doesn't exist in table 'trackfield_table' mysql> explain select recce_done from trackfield_table use index (track_id_FX) where track_id = 25.73955998120946; ERROR 1176 (42000): Key 'track_id_FX' doesn't exist in table 'trackfield_table'

Hello kalasha, can you please open a support ticket at FromDuals ticketing tool? Nobody will take care here... Regards, Oli
olicomment