What the best Configurationfor mysql using 4GB I'm trying to  improve my mysql performance. So I add more memory. But still slow in some part. Im most LEFT JOINs and UPDATE. 

My database have 45GB of data.

My current mysql configuration is:

key_buffer_size = 256M
max_allowed_packet = 1024M
table_open_cache = 5000
sort_buffer_size = 4M
net_buffer_length = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 64M


innodb_buffer_pool_size = 4G
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 100

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 256M
write_buffer = 256M


The question is. This is the best configuration ?

MY Serve is running: Linux/Open Suse

4GB of ram

4 cores.
Terrible:  innodb_buffer_pool_size = 4G and 4GB of RAM.  You must not over-allocate RAM; performance suffers terribly.  Change that to 1500M.  (Even 80% is dangerously high for a mere 4GB of RAM.)

key_buffer_size = 256M -- If you are not using MyISAM tables, change this to 20M.

table_open_cache = 5000 -- If you don't have thousands of tables, change this to, say, 1500.

Yes 45GB of data will work with only 1.5G of buffer_pool.  But it may be slow.  Let's see some of the slow queries.  The solution may be as simple as adding a 'composite' index to help a query.

In general, one should not modify my.cnf settings other than the buffer_pool.  Raising values, in any cases, hurts performance.