Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question Website Slow due to database

    Hi

    If I have a database driven website with hundreds of pages, and someday if my users starts complaining that the website is very slow, how do I know the bottleneck?

    Is there anyway in mysql to know what query is causing slowness?


    Thanks

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    phantom007 (10-01-2013)

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    yes you can use the EXPLAIN keyword for your queries but when you do not know which query is causing the slowness, is there any way to quickly find out the bottleneck?

    Is there some kind of mysql logging that can help in finding out?


    Thanks

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    Start here:
    http://dev.mysql.com/doc/refman/5.5/en/query-log.html

    Have fun reading. There is a *LOT* of information in the MySQL documentation about all of this. Don't expect someone to give you an answer in 3 paragraphs in this forum when MySQL gives you pages and pages and pages of information and all you have to do is read it.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    phantom007 (10-01-2013)

  • #5
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Thanks for sharing the link

  • #6
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,872
    Thanks
    2
    Thanked 164 Times in 159 Posts
    In addition to the general query log, you'll also want to look at using the slow query log.

  • Users who have thanked FishMonger for this post:

    phantom007 (10-01-2013)

  • #7
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by FishMonger View Post
    In addition to the general query log, you'll also want to look at using the slow query log.
    Thanks man, this is what I was looking for


    Cheers!!

  • #8
    New Coder
    Join Date
    Oct 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't expect someone to give you an answer in 3 paragraphs in this forum when MySQL gives you pages and pages and pages of information and all you have to do is read it.
    Finding the problem is a one-paragraph deal; open the application, see which operations are slow, look at the code for that operaton and see which queries are executed.

    The general log only tells you which queries are executed and unless you are the only user at the time, you'll see a ton of queries that make no sense at all. The slow query log only tells you which queries take longer than some predefined limit. If you run 100 queries that take 90% of the limit each then you will never see any of them.

    You are much better off reading things like the MySQL Performance blog, they have thought about how to find and fix performance errors and made it understandable.
    They know how you read the performance schema and show which tables get too manu sequential scans etc (the usual culprit)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •