Solved

MySQL 5.56 slower queries than 5.1.56

Posted on 2011-09-23
8
390 Views
Last Modified: 2012-08-14
Hello,

I dumped my database and installed it on the newer version 5.56 from 5.1.56.

The queries are now some 500% slower.

Is this a case of re-inexing the content? Does anyone know the differences I should be mindful of? They are MyISAM engine and select statements. The queries have been optimised and the indexes applied so want to focus on just the differences between 5.56 and 5.1.56.

Thanks for anyhelp.

David
0
Comment
Question by:dolythgoe
  • 4
  • 4
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36586764
please check the EXPLAIN plans for the same queries on the 2 servers, and compare.
you may post them here ...
0
 

Author Comment

by:dolythgoe
ID: 36587125
Oddly enough - the same in every way but 5.56 actually looks up on less rows - not sure if this is because of an efficiency improvement.

I think I've realised the error of my ways in the my.cnf. The queries were fast up until a point where more frequent words were used and then it dropped off a cliff - the tmp_table_size and max_heap_table_size were set at 16M and it went over this so I've set about to find the my.cnf on ubuntu server.

I have a db master and slave and found my.cnf in etc/mysql/my.cnf (on master) except it's readonly..

Coming from CentOs it's all slightly different - do you know where the writable one is?

I have a load balanced web1 web2 and db master and db slave all running ubuntu.

Cheers
David
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36587146
>Coming from CentOs it's all slightly different - do you know where the writable one is?
no, my world is microsoft in that regards ... (shame on me ... :)

but I think with my.cnf you are on the right track (would have been my suggestion to compare those parameters)

is the file readonly because of permissions on plain file-level?
0
 

Author Comment

by:dolythgoe
ID: 36587263
good point...just tried to chmod it but got a permissions denied - so checking with the host about that.

SQL Yog showed this for the query with frequent words:

state                                     duration (summed) in sec       percentage
converting HEAP to MyISAM       3.09217                              60.35410
Copying to tmp table                   0.98924                              19.30835
Copying to tmp table on disk       0.95379                              18.61642

That confirms it I think - absolutely trashed the speed when it gets above the mem allocation!!

Starting to learn a lot more about analysing queries with your help which is so useful!

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 36587483
you surely know about this reference page?
http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html
0
 

Assisted Solution

by:dolythgoe
dolythgoe earned 0 total points
ID: 36589883
I do - I've read it a few times but just like to run something by you. Bolded excerpts below.

So if you have 1GB memory on the DB server and expect very many simultaneous connects, what would you derive from these statements. On one hand I want lots of memory allocated to the heavy sorting operations but also want to make sure I don't bloat or 'ringfence' too much memory per user...

Is my thinking wrong and it will adapt to suit?

   If you have at least 256MB of memory and many tables and want maximum performance with a moderate number of clients, you should use something like this:

    shell> mysqld_safe --key_buffer_size=64M --table_cache=256 \
               --sort_buffer_size=4M --read_buffer_size=1M &


    If you have only 128MB of memory and only a few tables, but you still do a lot of sorting, you can use something like this:

    shell> mysqld_safe --key_buffer_size=16M --sort_buffer_size=1M

    If there are very many simultaneous connections, swapping problems may occur unless mysqld has been configured to use very little memory for each connection. mysqld performs better if you have enough memory for all connections.

    With little memory and lots of connections, use something like this:

    shell> mysqld_safe --key_buffer_size=512K --sort_buffer_size=100K \
               --read_buffer_size=100K &

    Or even this:

    shell> mysqld_safe --key_buffer_size=512K --sort_buffer_size=16K \
               --table_cache=32 --read_buffer_size=8K \
               --net_buffer_length=1K &


0
 

Author Closing Comment

by:dolythgoe
ID: 36895812
Seeking more confirmation around optimisation methods - looks like I'm ont he right track :)
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36598762
hi,

  it's a bit of compromise, based on the application.
  the settings in question are per server, not per user, so you play safe there.  

  with 1GB on your hands, you could assign 256MB for the key_buffer_size, and 640MB for the table_cache, for example.

CHeers.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now