Jump to content

Slow Sql


djp1988
 Share

Recommended Posts

I have a slow ajax, it is performing a simple select with a LIKE statement, but it is taking up to 9 seconds to finish, which is quite slow, my table has over 16000 rows is this the problem and if so what should I do to get around the problem?The actual table is 1.5Mb in size and has 8 fields, int(10),smallint(2), and 6 varchar(50)

Edited by djp
Link to comment
Share on other sites

Look into adding fulltext indexes on any fields that you are using LIKE with, and for other fields that you are using in the WHERE clause create regular indexes. Indexes speed up searching but slightly slow down inserting, updating, and deleting.

Link to comment
Share on other sites

Put them in a loop and time it. Have a loop that runs a certain piece of code several hundred thousand times, and time how long it takes the loop to finish, then divide by the number of times the loop ran to get the average time for each iteration. Most languages have various ways to keep track of time.

Link to comment
Share on other sites

I was using Inodb to keep everything tied together, and i didn't need to time the query, it literally took up to 10 seconds to produce a result and now it does it in less the half a second

Link to comment
Share on other sites

Oh well in Innodb I couldn't add a fullindex to any fields, the only reason the mysql gave me was it can't add fulltexxt index to inodb, so i switched back to MyISAM

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...