MySQL Forums
Forum List  »  Optimizer & Parser

Why isn't the index being used?
Posted by: Jim Daemon
Date: June 12, 2006 06:11PM

I have the following table:

CREATE TABLE `ftboscaff_rt_session` (
`session_id` varchar(50) NOT NULL default '',
`affiliate_id` bigint(20) unsigned default NULL,
`affiliate_commission` decimal(3,2) default NULL,
`gui_id` bigint(20) default NULL,
`tracking_id` bigint(20) default NULL,
`slave_id` bigint(20) unsigned default NULL,
`tracking_commission` decimal(3,2) default NULL,
`slave_commission` decimal(3,2) default NULL,
`modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`master_id` bigint(20) default NULL,
`master_commission` decimal(3,2) default NULL,
PRIMARY KEY (`session_id`),
KEY `gui_id` (`gui_id`),
KEY `tracking_id` (`tracking_id`),
KEY `affiliate_id` (`affiliate_id`),
KEY `master_id` (`master_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and executing the following query:
SELECT session_id, affiliate_id, affiliate_commission, gui_id, tracking_id, slave_id, tracking_commission, slave_commission, modified, master_id, master_commission, UNIX_TIMESTAMP( modified ) AS modified_t, UNIX_TIMESTAMP( ) AS now_t
FROM `ftboscaff_rt_session`
WHERE `session_id` = 'ffdde1b419d42c3ba6c7b856bd738a1b'
LIMIT 0 , 30

and according to EXPLAIN the primary index is not being used:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE ftboscaff_rt_session system PRIMARY NULL NULL NULL 1

Any ideas why the index is not being used and how I can correct that.

Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a person does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses their intelligence.

Options: ReplyQuote


Subject
Views
Written By
Posted
Why isn't the index being used?
3344
June 12, 2006 06:11PM
1895
June 12, 2006 06:41PM
2153
June 13, 2006 08:41AM
1932
June 13, 2006 09:11AM
1951
June 13, 2006 09:54AM
1954
June 13, 2006 04:03PM


Sorry, you can't reply to this topic. It has been closed.

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.