0

# Query_time: 6.081227 Lock_time: 0.000085 Rows_sent: 1 Rows_examined: 1339


SELECT COUNT(id) FROM `article` WHERE `category` = 'shkrime-te-perkthyera'


Is there a way to speed it up. Should I index the category column?
Or what do you suggest? I use this query to get the number of articles on that category!

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by smartness
0

Indexing should make searches fast but may also make updating/inserting/deleting records slower and may also take up more space in the database

0

Just how many rows are in the table?

I've just run several similar queries on a remote database table with 62000 rows, and the variations I tried took from 0.093 to 0.171 seconds. No index on the columns I used.

0

Indexing should make searches fast but may also make updating/inserting/deleting records slower and may also take up more space in the database

Does the size matter? I have enough free space on the hosting (it's a unlimited plan). I update every article view, current views + 1 each time it's visited. Could indexing slow the site down?

Just how many rows are in the table?

I've just run several similar queries on a remote database table with 62000 rows, and the variations I tried took from 0.093 to 0.171 seconds. No index on the columns I used.

1,341 Rows - MyISAM - utf8_unicode_ci - 25.9 MiB

This is the table structure...

CREATE TABLE IF NOT EXISTS `artikulli` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `autori` varchar(100) CHARACTER SET utf8 NOT NULL,
  `category` varchar(100) CHARACTER SET utf8 NOT NULL,
  `titulli` varchar(350) CHARACTER SET latin1 NOT NULL,
  `url_alias` varchar(400) COLLATE utf8_unicode_ci NOT NULL,
  `burimi` varchar(200) CHARACTER SET utf8 NOT NULL,
  `teksti` text CHARACTER SET latin1 NOT NULL,
  `intro` text COLLATE utf8_unicode_ci NOT NULL,
  `picture` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `date` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `views` int(10) NOT NULL,
  `featured` tinyint(1) NOT NULL,
  `ft_order` int(10) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `featured` (`featured`),
  KEY `category` (`category`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1348 ;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.