# New, Need Help

**URL:** <https://forums.percona.com/t/new-need-help/247>\
**Category:** Other MySQL® Questions\
**Created:** [March 16, 2007, 7:20pm UTC](https://forums.percona.com/t/new-need-help/247 "2007-03-16T19:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfittsy](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@tfittsy](https://forums.percona.com/u/tfittsy)\
**Post date:** [March 16, 2007, 7:20pm UTC](https://forums.percona.com/t/new-need-help/247/1 "2007-03-16T19:20:04Z")

</div>

Hi,

I am running a pretty small MySQL Database (92 tables, biggest table is under 35000 rows, average is 2000 rows, only 40 of them have over 250 rows)

But performance seems sub-obtimal. I’m running the database on a dedicated server with Core 2 Duo and 2GB Ram. The only other duties of the server are a standard web server. I noticed that mysql is using about 35% of my cpu usage (which I guess is only 17% on dual core). I can definelty spare it, but it still seems high and I would like to optimize it my DB and queries as much as possible.

Below is what I get for runtime variables.

Value Variable1 Flush\_commands299 Slow\_queries643 Handler\_commit670 k Handler\_delete0 Handler\_discover24 M Handler\_read\_first1,744 M Handler\_read\_key862 M Handler\_read\_next12 M Handler\_read\_prev131 M Handler\_read\_rnd1,020 M Handler\_read\_rnd\_next567 Handler\_rollback2,033 M Handler\_update375 M Handler\_write0 Qcache\_free\_blocks0 Qcache\_free\_memory0 Qcache\_hits0 Qcache\_inserts0 Qcache\_lowmem\_prunes0 Qcache\_not\_cached0 Qcache\_queries\_in\_cache0 Qcache\_total\_blocks308 Slow\_launch\_threads0 Threads\_cached4 Threads\_connected1,376 k Threads\_created1 Threads\_running0.00% Threads\_cache\_hitrate\_%0 Binlog\_cache\_disk\_use0 Binlog\_cache\_use Begin Temporary data355 k Created\_tmp\_disk\_tables4,984 Created\_tmp\_files17 M Created\_tmp\_tables0 Delayed\_insert\_threads0 Delayed\_writes0 Not\_flushed\_delayed\_rows0 Key\_blocks\_not\_flushed5,713 Key\_blocks\_unused1,952 Key\_blocks\_used235.87G Key\_read\_requests29 M Key\_reads11 M Key\_write\_requests289 k Key\_writes30.26% Key\_buffer\_fraction\_%2,664 k Select\_full\_join0 Select\_full\_range\_join12 k Select\_range0 Select\_range\_check24 M Select\_scanNULL Rpl\_status0 Slave\_open\_temp\_tables0 Slave\_retried\_transactionsOFF Slave\_running2,490 Sort\_merge\_passes15 k Sort\_range188 M Sort\_rows17 M Sort\_scan64 Open\_tables4,399 k Opened\_tables165 M Table\_locks\_immediate312 k Table\_locks\_waited116 Open\_files0 Open\_streams

From what I read, I’m most concerned about:

slow\_queries  
Handler\_read\_rnd  
Handler\_read\_rnd\_next  
slow\_launch\_threads  
Created\_tmp\_disk\_tables  
Select\_full\_join  
Sort\_merge\_passes  
Opened\_tables  
Table\_locks\_waited

I’m on MySql 4.1.21 and can’t move to 5+ for at least a few more months. I realize a lot of it is probably that my queries aren’t optimized so if someone can tell me what I need to do to log the slow queries and the ones that cause hanlder\_read\_rnd and rnd\_next and select\_full\_join to be so high so that I can find and fix them I would apprecaite it.

Also, if someone can tell me how to change my settings (and what I should change them to) to maximize performance and memory usage (the whole database should easily fit in ram) and anything else I can do to speed things up.

Thanks.

---

<div class="post-metadata">

**Author:** ![kenmcd](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@kenmcd](https://forums.percona.com/u/kenmcd)\
**Post date:** [March 21, 2007, 5:00pm UTC](https://forums.percona.com/t/new-need-help/247/2 "2007-03-21T17:00:05Z")

</div>

| [B]tfittsy wrote on Fri, 16 March 2007 20:50[/B] |
| 

0 Qcache\_free\_blocks0 Qcache\_free\_memory0 Qcache\_hits0 Qcache\_inserts0 Qcache\_lowmem\_prunes0 Qcache\_not\_cached0 Qcache\_queries\_in\_cache0 Qcache\_total\_blocks0 Threads\_cached0.00% Threads\_cache\_hitrate\_%64 Open\_tables4,399 k Opened\_tables

 |

Enable the Query cache Enable the Thread cache Enable the Table cache

Those would speed things up substantially.

---

<div class="post-metadata">

**Author:** ![tanj](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@tanj](https://forums.percona.com/u/tanj)\
**Post date:** [March 22, 2007, 8:23am UTC](https://forums.percona.com/t/new-need-help/247/3 "2007-03-22T08:23:02Z")

</div>

Please post output of SHOW VARIABLES, so we could comment the server settings.
