View Single Post
Old 03-19-2011, 11:22 AM  
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Quote:
Originally Posted by Jakez View Post
Does a large database have the most impact on page load times or cpu load?

I have a table with about 1,000,000 entries so far, every time an image on the page is clicked it inserts an entry, and on every page load it groups the table by 'img' and then sorts by the amount of entries (or clicks) for each img, then displays them in order on the page, about 50 thumbs.

I'm mostly concerned about how long it takes the page to load, does sorting this big of a table make the page load a lot slower or is it mostly unnoticeable?

The table (size is about 70mb):
(
`id` int(11) NOT NULL auto_increment,
`time` int(11) NOT NULL,
`img` varchar(255) NOT NULL,
`country` varchar(30) NOT NULL,
`c_ip` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=latin1;

What woj said, but 2 main concerns -

1. if you're grouping by image, the img really should be img_id - an int(x) where x is large enough for all your images (ie 4 if you have <9999 images). Far far faster to group an integer index than a varchar one, since the index will be numeric and a shit load smaller.

2. If this is the table that is getting hit with the inserts when an image is viewed, you really should make it an InnoDB table, not myisam.
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202

Last edited by borked; 03-19-2011 at 11:23 AM..
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote