I have this query:
SELECT id,type,source_id,link,short_link,cat_id,title,description,images,views,comments,published,publishedon FROM listings WHERE
(YEARWEEK( FROM_UNIXTIME( publishedon ) , 1 ) = YEARWEEK( CURDATE( ) , 1 )) AND
(id != 88587) AND
(cat_id = '64')
AND (deleted = 0)
AND (published = 1)
ORDER BY views DESC LIMIT 1 OFFSET 0
CREATE TABLE IF NOT EXISTS `listings` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` tinyint(1) NOT NULL DEFAULT '1',
`hash` char(32) NOT NULL,
`source_id` int(10) unsigned NOT NULL,
`link` varchar(255) NOT NULL,
`short_link` varchar(255) NOT NULL,
`cat_id` mediumint(5) NOT NULL,
`title` mediumtext NOT NULL,
`description` mediumtext,
`content` mediumtext,
`images` mediumtext,
`videos` mediumtext,
`views` int(10) unsigned NOT NULL,
`comments` int(11) DEFAULT '0',
`comments_update` int(11) NOT NULL DEFAULT '0',
`editor_id` int(11) NOT NULL DEFAULT '0',
`auther_name` varchar(255) DEFAULT NULL,
`createdby_id` int(10) NOT NULL,
`createdon` int(20) NOT NULL,
`editedby_id` int(10) NOT NULL,
`editedon` int(20) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`deletedon` int(20) NOT NULL,
`deletedby_id` int(10) NOT NULL,
`deletedfor` varchar(255) NOT NULL,
`published` tinyint(1) NOT NULL DEFAULT '1',
`publishedon` int(20) NOT NULL,
`publishedby_id` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8956 ;
I cannot make any changes in fields types.
Is there any way to make it fast? It takes to execute 0.7518 sec,0.8776 sec.
CREATE TABLE
statement instead of that image.