MySQL Forums :: Newbie :: index is not used why?


Advanced Search

index is not used why?
Posted by: Thomas Jüntgen ()
Date: March 18, 2009 05:32AM

Hello all

I have this table with more then 15000 rows.
CREATE TABLE `t_event_calendar` (
`c_id` varchar(45) NOT NULL default '',
`d_start` datetime NOT NULL default '0000-00-00 00:00:00',
`d_start_aktuell` datetime default '0000-00-00 00:00:00',
`d_ende_aktuell` datetime default '0000-00-00 00:00:00',
`d_ende` datetime NOT NULL default '0000-00-00 00:00:00',
`n_typ_id` int(11) NOT NULL default '0',
`n_optionen` int(11) NOT NULL default '0',
`n_status` int(11) default NULL,
`n_label_farbe` int(11) default NULL,
`c_ort` varchar(45) default NULL,
`n_kunde_id` int(11) default NULL,
`c_notiz` text,
`c_parent_id` varchar(45) default NULL,
`n_recurrence_idx` int(11) default NULL,
`c_text` varchar(45) NOT NULL default '',
`n_resource_id` varchar(45) default NULL,
`n_group_id` int(11) default NULL,
`n_internal_event_type` int(11) NOT NULL default '0',
`n_reminder_min` int(11) default NULL COMMENT 'the minutes before start time when the reminder should appear',
`d_reminder_date` datetime default NULL,
`n_recurrence_info` text,
`c_task_id` varchar(40) default NULL COMMENT 't_event_task',
`m_keys` text COMMENT 'db keys for faster access',
`n_public` tinyint(1) NOT NULL default '1',
`n_erledigt` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`c_id`),
KEY `IDX_START_RESOURCE` (`d_start`,`n_resource_id`),
KEY `IDX_RESOURCE_GROUP` (`n_resource_id`,`n_group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED;

This select is not using the index. Instead it using the type 'ALL'.
SELECT *
FROM t_event_calendar
WHERE (n_resource_id = 4 OR n_group_id IN (1) OR (n_group_id IS NULL AND n_resource_id IS NULL))

Could any onel help me?
Thanks Thomas

Options: ReplyQuote


Subject Written By Posted
index is not used why? Thomas Jüntgen 03/18/2009 05:32AM
Re: index is not used why? Rick James 03/19/2009 07:45PM
Re: index is not used why? Thomas Jüntgen 03/24/2009 08:09AM
Re: index is not used why? Peter Brawley 03/24/2009 08:15AM
Re: index is not used why? Rick James 03/24/2009 08:11PM
Re: index is not used why? Peter Brawley 03/24/2009 08:34PM
Re: index is not used why? Thomas Jüntgen 03/26/2009 03:49AM


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.