# Looking for Suggestions on Improving Performance

**URL:** <https://forums.percona.com/t/looking-for-suggestions-on-improving-performance/288>\
**Category:** Other MySQL® Questions\
**Created:** [April 13, 2007, 7:07pm UTC](https://forums.percona.com/t/looking-for-suggestions-on-improving-performance/288 "2007-04-13T19:07:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![locutus233ca](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@locutus233ca](https://forums.percona.com/u/locutus233ca)\
**Post date:** [April 13, 2007, 7:07pm UTC](https://forums.percona.com/t/looking-for-suggestions-on-improving-performance/288/1 "2007-04-13T19:07:18Z")

</div>

Hello,

I’m looking for some suggestions. I have a 50G database that grows on average about 1-2gigs of information a day.

I’m looking for some suggestion on how to improve performance on some new systems i have. I have run some preformance tests with mysql bench to get an idea of how they are performing, I was wondering if anyone had any additional suggestions on what i can tune in the configuration of mysql.

Prsently were running MySQL 4.0.24 with CentOS 4.4 X86\_64.

The system i ran this test on has the following:  
[[root&#64;cf-db7](mailto:root&#64;cf-db7) sql-bench]# cat /proc/cpuinfo | grep processor  
processor : 0  
processor : 1  
processor : 2  
processor : 3

CPU info:  
vendor\_id : GenuineIntel  
cpu family : 6  
model : 15  
model name : Intel(R) Xeon(R) CPU 5130 @ 2.00GHz  
stepping : 6  
cpu MHz : 1995.004  
cache size : 4096 KB  
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm pni monitor ds\_cpl tm2 cx16 xtpr  
bogomips : 3990.05  
clflush size : 64  
cache\_alignment : 64  
address sizes : 36 bits physical, 48 bits virtual  
power management:

[[root&#64;cf-db7](mailto:root&#64;cf-db7) sql-bench]# cat /proc/meminfo  
MemTotal: 16410608 kB  
MemFree: 12325424 kB  
Buffers: 166224 kB  
Cached: 3346656 kB  
[[root&#64;cf-db7](mailto:root&#64;cf-db7) sql-bench]#

Here is my my.cnf file as well:

[[root&#64;cf-db7](mailto:root&#64;cf-db7) sql-bench]# cat /etc/my.cnf

# Example MySQL config file for very large systems.

# 

# This is for a large system with memory of 1G-2G where the system runs mainly

# MySQL.

# 

# You can copy this file to

# /etc/my.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options (in this

# installation this directory is /usr/local/mysql/data) or

# ~/.my.cnf to set user-specific options.

# 

# In this file, you can use all long options that a program supports.

# If you want to know which options a program supports, run the program

# with the “–help” option.

# The following options will be passed to all MySQL clients

[client]  
#password = your\_password  
port = 3306  
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server

[mysqld]  
port = 3306  
socket = /tmp/mysql.sock  
skip-locking  
key\_buffer = 4096M  
max\_allowed\_packet = 32M  
table\_cache = 1024  
sort\_buffer\_size = 4M  
read\_buffer\_size = 4M  
myisam\_sort\_buffer\_size = 128M  
thread\_cache = 16  
query\_cache\_size = 72M

# Try number of CPU’s\*2 for thread\_concurrency

thread\_concurrency = 8

max\_connections=2000  
wait\_timeout=300  
interactive\_timeout=1200  
long\_query\_time=3

basedir=/usr/local/mysql

# Don’t listen on a TCP/IP port at all. This can be a security enhancement,

# if all processes that need to connect to mysqld run on the same host.

# All interaction with mysqld must be made via Unix sockets or named pipes.

# Note that using this option without enabling named pipes on Windows

# (via the “enable-named-pipe” option) will render mysqld useless!

# 

#skip-networking

# Replication Master Server (default)

# binary logging is required for replication

#log-bin

# required unique id between 1 and 2^32 - 1

# defaults to 1 if master-host is not set

# but will not function as a master if omitted

server-id = 1

# Replication Slave (comment out master section to use this)

# 

# To configure this host as a replication slave, you can choose between

# two methods :

# 

# 1) Use the CHANGE MASTER TO command (fully described in our manual) -

# the syntax is:

# 

# CHANGE MASTER TO MASTER\_HOST=, MASTER\_PORT=,

# MASTER\_USER=, MASTER\_PASSWORD= ;

# 

# where you replace , , by quoted strings and

# by the master’s port number (3306 by default).

# 

# Example:

# 

# CHANGE MASTER TO MASTER\_HOST=‘125.564.12.1’, MASTER\_PORT=3306,

# MASTER\_USER=‘joe’, MASTER\_PASSWORD=‘secret’;

# 

# OR

# 

# 2) Set the variables below. However, in case you choose this method, then

# start replication for the first time (even unsuccessfully, for example

# if you mistyped the password in master-password and the slave fails to

# connect), the slave will create a master.info file, and any later

# change in this file to the variables’ values below will be ignored and

# overridden by the content of the master.info file, unless you shutdown

# the slave server, delete master.info and restart the slaver server.

# For that reason, you may want to leave the lines below untouched

# (commented) and instead use CHANGE MASTER TO (see above)

# 

# required unique id between 2 and 2^32 - 1

# (and different from the master)

# defaults to 2 if master-host is set

# but will not function as a slave if omitted

#server-id = 2

# 

# The replication master for this slave - required

#master-host =

# 

# The username the slave will use for authentication when connecting

# to the master - required

#master-user =

# 

# The password the slave will authenticate with when connecting to

# the master - required

#master-password =

# 

# The port the master is listening on.

# optional - defaults to 3306

#master-port =

# 

# binary logging - not required for slaves, but recommended

#log-bin

# Point the following paths to different dedicated disks

#tmpdir = /tmp/  
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables

#bdb\_cache\_size = 384M  
#bdb\_max\_lock = 100000

# Uncomment the following if you are using InnoDB tables

#innodb\_data\_home\_dir = /usr/local/mysql/data/  
#innodb\_data\_file\_path = ibdata1:2000M;ibdata2:10M:autoextend  
#innodb\_log\_group\_home\_dir = /usr/local/mysql/data/  
#innodb\_log\_arch\_dir = /usr/local/mysql/data/

# You can set ..\_buffer\_pool\_size up to 50 - 80 %

# of RAM but beware of setting memory usage too high

#innodb\_buffer\_pool\_size = 384M  
#innodb\_additional\_mem\_pool\_size = 20M

# Set ..\_log\_file\_size to 25 % of buffer pool size

#innodb\_log\_file\_size = 100M  
#innodb\_log\_buffer\_size = 8M  
#innodb\_flush\_log\_at\_trx\_commit = 1  
#innodb\_lock\_wait\_timeout = 50

[mysqldump]  
quick  
max\_allowed\_packet = 16M

[mysql]  
no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

[isamchk]  
key\_buffer = 256M  
sort\_buffer\_size = 256M  
read\_buffer = 2M  
write\_buffer = 2M

[myisamchk]  
key\_buffer = 256M  
sort\_buffer\_size = 256M  
read\_buffer = 2M  
write\_buffer = 2M

[mysqlhotcopy]  
interactive-timeout  
[[root&#64;cf-db7](mailto:root&#64;cf-db7) sql-bench]#

Finally here is the mysql bench output:

Benchmark DBD suite: 2.15  
Date of test: 2007-04-13 17:15:49  
Running tests on: Linux 2.6.9-42.0.10.ELsmp x86\_64  
Arguments: --socket=/tmp/mysql.sock  
Comments:  
Limits from:  
Server version: MySQL 4.0.24 standard  
Optimization: None  
Hardware:

alter-table: Total time: 13 wallclock secs ( 0.02 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.04 CPU)  
ATIS: Total time: 5 wallclock secs ( 3.31 usr 0.88 sys + 0.00 cusr 0.00 csys = 4.19 CPU)  
big-tables: Total time: 5 wallclock secs ( 1.78 usr 1.60 sys + 0.00 cusr 0.00 csys = 3.38 CPU)  
connect: Total time: 51 wallclock secs (12.94 usr 13.27 sys + 0.00 cusr 0.00 csys = 26.21 CPU)  
create: Total time: 231 wallclock secs ( 1.13 usr 0.53 sys + 0.00 cusr 0.00 csys = 1.66 CPU)  
insert: Total time: 438 wallclock secs (165.75 usr 57.61 sys + 0.00 cusr 0.00 csys = 223.36 CPU)  
select: Total time: 53 wallclock secs (16.92 usr 4.79 sys + 0.00 cusr 0.00 csys = 21.71 CPU)  
transactions: Test skipped because the database doesn’t support transactions  
wisconsin: Total time: 4 wallclock secs ( 1.19 usr 0.56 sys + 0.00 cusr 0.00 csys = 1.75 CPU)

All 9 test executed successfully

Totals per operation:  
Operation seconds usr sys cpu tests  
alter\_table\_add 6.00 0.00 0.01 0.01 100  
alter\_table\_drop 5.00 0.01 0.00 0.01 91  
connect 3.00 2.16 0.44 2.60 10000  
connect+select\_1\_row 4.00 2.22 0.69 2.91 10000  
connect+select\_simple 4.00 2.24 0.55 2.79 10000  
count 6.00 0.02 0.00 0.02 100  
count\_distinct 0.00 0.08 0.02 0.10 1000  
count\_distinct\_2 0.00 0.08 0.02 0.10 1000  
count\_distinct\_big 5.00 3.01 0.80 3.81 120  
count\_distinct\_group 0.00 0.38 0.10 0.48 1000  
count\_distinct\_group\_on\_key 0.00 0.07 0.04 0.11 1000  
count\_distinct\_group\_on\_key\_parts 1.00 0.38 0.09 0.47 1000  
count\_distinct\_key\_prefix 0.00 0.07 0.01 0.08 1000  
count\_group\_on\_key\_parts 0.00 0.35 0.11 0.46 1000  
count\_on\_key 15.00 3.17 0.91 4.08 50100  
create+drop 64.00 0.32 0.09 0.41 10000  
create\_MANY\_tables 99.00 0.30 0.07 0.37 10000  
create\_index 1.00 0.00 0.00 0.00 8  
create\_key+drop 65.00 0.36 0.10 0.46 10000  
create\_table 1.00 0.00 0.00 0.00 31  
delete\_all\_many\_keys 12.00 0.00 0.01 0.01 1  
delete\_big 0.00 0.00 0.00 0.00 1  
delete\_big\_many\_keys 12.00 0.00 0.01 0.01 128  
delete\_key 1.00 0.07 0.11 0.18 10000  
delete\_range 2.00 0.00 0.00 0.00 12  
drop\_index 1.00 0.00 0.00 0.00 8  
drop\_table 0.00 0.00 0.00 0.00 28  
drop\_table\_when\_MANY\_tables 2.00 0.06 0.14 0.20 10000  
insert 20.00 2.54 4.61 7.15 350768  
insert\_duplicates 5.00 1.00 1.44 2.44 100000  
insert\_key 21.00 1.66 1.05 2.71 100000  
insert\_many\_fields 1.00 0.08 0.02 0.10 2000  
insert\_select\_1\_key 1.00 0.00 0.00 0.00 1  
insert\_select\_2\_keys 1.00 0.00 0.00 0.00 1  
min\_max 2.00 0.01 0.00 0.01 60  
min\_max\_on\_key 8.00 5.39 1.69 7.08 85000  
multiple\_value\_insert 1.00 0.14 0.00 0.14 100000  
order\_by\_big 15.00 8.78 2.49 11.27 10  
order\_by\_big\_key 13.00 9.07 2.52 11.59 10  
order\_by\_big\_key2 12.00 8.76 2.50 11.26 10  
order\_by\_big\_key\_desc 12.00 9.14 2.49 11.63 10  
order\_by\_big\_key\_diff 13.00 8.81 2.48 11.29 10  
order\_by\_big\_key\_prefix 11.00 8.78 2.49 11.27 10  
order\_by\_key2\_diff 1.00 0.80 0.19 0.99 500  
order\_by\_key\_prefix 1.00 0.41 0.10 0.51 500  
order\_by\_range 1.00 0.42 0.10 0.52 500  
outer\_join 1.00 0.00 0.00 0.00 10  
outer\_join\_found 1.00 0.00 0.00 0.00 10  
outer\_join\_not\_found 0.00 0.00 0.00 0.00 500  
outer\_join\_on\_key 0.00 0.00 0.00 0.00 10  
select\_1\_row 7.00 1.00 1.83 2.83 100000  
select\_1\_row\_cache 4.00 0.78 2.17 2.95 100000  
select\_2\_rows 8.00 1.06 2.19 3.25 100000  
select\_big 11.00 8.82 2.48 11.30 80  
select\_big\_str 4.00 1.35 0.62 1.97 10000  
select\_cache 1.00 0.63 0.22 0.85 10000  
select\_cache2 29.00 0.75 0.11 0.86 10000  
select\_column+column 8.00 0.92 1.69 2.61 100000  
select\_diff\_key 33.00 0.05 0.01 0.06 500  
select\_distinct 1.00 0.63 0.16 0.79 800  
select\_group 1.00 0.43 0.10 0.53 2911  
select\_group\_when\_MANY\_tables 1.00 0.09 0.13 0.22 10000  
select\_join 1.00 0.20 0.05 0.25 100  
select\_key 28.00 14.69 4.07 18.76 200000  
select\_key2 29.00 14.21 3.99 18.20 200000  
select\_key2\_return\_key 29.00 13.54 4.01 17.55 200000  
select\_key2\_return\_prim 29.00 14.19 3.95 18.14 200000  
select\_key\_prefix 29.00 14.16 4.09 18.25 200000  
select\_key\_prefix\_join 2.00 1.69 0.44 2.13 100  
select\_key\_return\_key 29.00 13.86 4.11 17.97 200000  
select\_many\_fields 4.00 1.70 1.58 3.28 2000  
select\_range 5.00 3.39 0.88 4.27 410  
select\_range\_key2 2.00 1.54 0.44 1.98 25010  
select\_range\_prefix 2.00 1.53 0.40 1.93 25010  
select\_simple 4.00 0.49 1.38 1.87 100000  
select\_simple\_cache 4.00 0.72 1.71 2.43 100000  
select\_simple\_join 0.00 0.22 0.06 0.28 500  
update\_big 7.00 0.00 0.00 0.00 10  
update\_of\_key 4.00 0.49 0.73 1.22 50000  
update\_of\_key\_big 3.00 0.01 0.00 0.01 501  
update\_of\_primary\_key\_many\_keys 8.00 0.01 0.00 0.01 256  
update\_with\_key 19.00 2.48 4.49 6.97 300000  
update\_with\_key\_prefix 7.00 1.52 1.55 3.07 100000  
wisc\_benchmark 2.00 1.00 0.18 1.18 114  
TOTALS 805.00 199.29 78.31 277.60 3225950  
[[root&#64;cf-db7](mailto:root&#64;cf-db7) sql-bench]#

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [April 20, 2007, 4:46pm UTC](https://forums.percona.com/t/looking-for-suggestions-on-improving-performance/288/2 "2007-04-20T16:46:12Z")

</div>

sql-bench is irrelevant.

I’d focus on real things which cause problems for your application.  
Check slow query log and frequent queries with EXPLAIN etc.

---

<div class="post-metadata">

**Author:** ![MayaMcCarthy](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mayamccarthy/32/159_2.png) [@MayaMcCarthy](https://forums.percona.com/u/MayaMcCarthy)\
**Post date:** [November 1, 2020, 11:56pm UTC](https://forums.percona.com/t/looking-for-suggestions-on-improving-performance/288/3 "2020-11-01T23:56:20Z")

</div>

You can tune your [MYSQL query](https://www.optimizsql.com) by following steps:

- Reducing table size

- Making joins less complicated

You can also look for database optimization.
