Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default mysql performance issue

    I couldn't find a database specific section to post this in. Hopefully it is OK here.

    Ocassionally (maybe once a day) my website goes down and zen states that it cannot connect to the database. What I have noticed is that the mysql instance is spiking the CPU over 100% constantly and doesn't allow zen to serve the pages. I have gone in to mysql and identified the query that is running the cpu up. I am however lost as to where this query is being spawned. Please find below the output from show SHOW PROCESSLIST; I identifed the listed query as the culprit and as soon as I kill it the DB performs normally. Please help...

    -----

    Id | User | Host | db | Command | Time | State | Info |
    +-------+--------------+-----------+--------------+---------+------+--------------+------------------------------------------------------------------------------------------------------+
    | 30366 | user | localhost | zendb | Query | 1485 | Sending data | select count(distinct p.products_id) as total FROM products p, products_description pd, products_t |
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: mysql performance issue

    Which site?
    How many products do you have?
    Have you any idea which link causes it?

    That query comes from the pagination logic which checks to see how many products fall in the specified category or filter, so that it can determine what "next page" links to show, etc.

    It would be helpful to know which filter link or sort link or pagination link you click on to trigger the problem.

    It would also be helpful to know the entire query, not just the first 100 characters, if possible.

    You could try running a REPAIR TABLE and OPTIMIZE TABLE on your products, products_description, and products_to_categories tables just in case something's damaged in them.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: mysql performance issue

    Thanks for the quick reply!

    Quote Originally Posted by DrByte View Post
    Which site?
    www.matchlockarms.com
    How many products do you have?
    6800

    Have you any idea which link causes it?
    I'm not sure if it is on the admin side or customer side. Or what link for that matter. I'm going to poke around a bit to see if i can make it happen.

    That query comes from the pagination logic which checks to see how many products fall in the specified category or filter, so that it can determine what "next page" links to show, etc.

    It would be helpful to know which filter link or sort link or pagination link you click on to trigger the problem.
    Hopefully i can identify and post back shortly.

    It would also be helpful to know the entire query, not just the first 100 characters, if possible.
    Do you know of a way to show the whole query show show processes or something of the like?

    You could try running a REPAIR TABLE and OPTIMIZE TABLE on your products, products_description, and products_to_categories tables just in case something's damaged in them.
    I'll try this. Anything to be concerned of when I do so?
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: mysql performance issue

    6800 products isn't a lot.
    If they're heavily laden with attributes, that does certainly create additional burden, but shouldn't seriously impact displaying a product listing.
    A REPAIR or OPTIMIZE will cause a temporary lock on the tables while it does the job, and customers will just experience a brief hang if they click while that lock is in place until the lock is released. If your store had 10x that many products then I'd suggest waiting until a slow time to do it.

    The slow-query-log might be needed for you to see the details of the query.
    Or a GUI tool like Navicat or SQLYog which can extract more information from the database than phpMyAdmin does in things like SHOW PROCESSES and other things.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Intermittent Performance Issue -- Really Need Help
    By kal130 in forum General Questions
    Replies: 12
    Last Post: 26 Jul 2011, 02:47 AM
  2. Performance Issue
    By theonlyduda in forum General Questions
    Replies: 9
    Last Post: 21 Dec 2009, 02:33 AM
  3. Who's Online Performance Issue
    By kanine in forum General Questions
    Replies: 6
    Last Post: 26 Apr 2009, 03:32 PM
  4. mysql query issue
    By Andy_GS in forum General Questions
    Replies: 0
    Last Post: 16 Mar 2009, 01:53 PM
  5. MySQL Issue on Install
    By chris_h in forum Installing on a Linux/Unix Server
    Replies: 8
    Last Post: 4 Apr 2007, 05:34 AM

Posting Permissions

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