Skip to main content

How to optimize my MySQL query to use less mysql connection?

Comments

4 comments

  • 24x7server
    Hello, max_user_connections value is totally depend on your server configuration and site traffic. You will need to change that with site traffic and VPS configurations. But I will suggest you please discuss this issues with your site developer . Your developer will optimize your MySQL query to use less mysql connection
    0
  • Nirjonadda
    Please can you let me know, How to optimize my MySQL query to use less mysql connection? what is good parameter to set for optimize? This is my default my.cnf settings.
    [mysqld] local-infile=0 max_connections=800 max_user_connections = 50 datadir="/var/lib/mysql" socket = "/var/lib/mysql/mysql.sock" key_buffer = 256M table_cache = 28560 open_files_limit=50000 join_buffer_size = 2M read_buffer_size = 2M sort_buffer_size = 6M tmp_table_size=128M read_rnd_buffer_size=4M max_heap_table_size=64M myisam_sort_buffer_size=64M thread_cache_size=8 thread_cache=512 query_cache_limit=12M query_cache_size=256M thread_concurrency = 8 wait_timeout=1000 connect_timeout=1000 interactive_timeout=1000 #log-slow-queries = /var/log/mysqlslowqueries.log max_allowed_packet=268435456 default-storage-engine=MyISAM innodb_file_per_table=1 [isamchk] key_buffer =64M sort_buffer_size = 64M read_buffer = 16M write_buffer = 16M [myisamchk] key_buffer = 64M sort_buffer_size = 64M read_buffer = 16M write_buffer = 16M [mysqlhotcopy] interactive-timeout [mysqld_safe] log-error="/var/log/mysqld.log"
    0
  • LostNerd
    Considering that your access level is "Website Owner", I am assuming that you don't administrate the server to increase the limit? The best way to reduce connections in your case is to have your web developer optimize his/her queries and joining them together... What I do, for example if pulling the information from the same row regularly, I'll dump it into an array so that it only has to make one connection per page load. :)
    0
  • cPanelMichael
    Hello, Could you clarify if you have root access to this server? If so, the following thread on using a MySQL tuner is a good place to start: mysqlmymonlite.sh server stats gathering tool for cPanel Server Thank you.
    0

Please sign in to leave a comment.