On Mon, 2007-07-02 at 21:19 -0700, Ed Lazor wrote: > I have a 400mb database. The first query to tables takes about 90 seconds. > Additional queries take about 5 seconds. I wait a while and run a query > again; it takes about 90 seconds for the first one and the rest go quickly. > I'm guessing data is being loaded into memory which is why things speed up. > > Does this sound right? Is there a way to keep the table in memory? Nothing > is changing in the data.
You probably have the query cache enabled already if it's behaving like this. See: http://dev.mysql.com/doc/refman/5.0/en/query-cache.html The query cache only works for the current connection, so if you open a connection and execute a query, it's only cached for *that* connection. But you should get MUCH better performance than what you're currently getting anyway. You need to look at your queries, and put indexes on appropriate fields. Generally you want them on fields used in joins, and fields in your 'where' clause. If you post your query and the output of 'show create table <TABLE_NAME>' for each table involved, someone might suggest which fields to add indexes to. -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]