'CREATE TABLE `access_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`EventTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',
`EventSize` int(10) unsigned NOT NULL DEFAULT ''0'',
`EventScore` double DEFAULT NULL,
`EventCustomer` intvarchar(11255) DEFAULT NULL,
`event_log_domain_id` smallint(6) DEFAULT NULL,
`EventUserID``EventIdentifier` smallintvarchar(5255) unsigned NOT NULL DEFAULT ''0''NULL,
`EventType` tinyint(3) unsigned NOT NULL DEFAULT ''0'',
`EventName` varchar(255) DEFAULT NULL,
`utc` tinyint(1) DEFAULT ''0'',
`job_queue_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `EventTime` (`EventTime`),
KEY `IndexUser``IndexIdentifier` (`EventUserID``EventIdentifier`),
KEY `IndexType` (`EventType`),
KEY `IndexUserType` (`EventUserID``EventIdentifier`,`EventType`),
KEY `event_log_domain_id` (`event_log_domain_id`),
KEY `job_queue_id` (`job_queue_id`),
KEY `EventTypeAndeventogdomainid` (`EventType`,`event_log_domain_id`),
KEY `eventogdomainidAndEventType` (`event_log_domain_id`,`EventType`),
FULLTEXT KEY `IndexEventName` (`EventName`)
) ENGINE=InnoDB AUTO_INCREMENT=123163064 DEFAULT CHARSET=latin1'
- EventName (wildcard search %search_string%, not always provided)
- EventCustomer (forward match search_string%, not always provided)
- EventUserIDEventIdentifier (forward match search_string%, not always provided)
- EventType (exact match, one or more ids but not always provided)
- event_log_domain_id (exact match, one or more ids always provided)
Then we fetch 50/100 records at the time so we do limit too. We also provide default order, or give ability to order by few columns (EventCustomer
, EventUserIDEventIdentifier
, EventType
and EventTime
).