PDA

View Full Version : large mysql database query speed



earthman
12-27-2006, 08:19 AM
hello all,

im wondering if anyone from experience can say how long a single query into a 2,000,000 record database takes?

the query is very simple eg "where x=y" so im hoping it will be relatively quick.

the problem is that im running this query 42 times on each and every page so wondering if it will be fast enough (eg under 1 second......preferably under 0.5 seconds)

If not, there are some other options!

Cheers

McCoy
12-27-2006, 09:15 AM
If you create an index from the column you're using as "y" it should be fairly fast, typically under 0.1s

Otherwise there can be speed problems. You can create an index via phpMyAdmin.

Also try to activate mysql caching, that will really help a lot if you're making the same query a lot of times one after the other, which seems to be your case (also, any way to decrease that query number? I'm sure you can improve the code to require less queries by saving previously obtained data in variables in your script). Although right now I don't know if it's activated as default in hostmonster or if you can activate manually, never tried.