Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Posts
    591
    Plugin Contributions
    0

    Default 1062 Duplicate entry for key 1 in table seo_cache

    Please help

    1062 Duplicate entry 'ca34fbe5f9a075091ad59abf02c259a7-1' for key 'PRIMARY'
    in:
    [INSERT INTO seo_cache (cache_id, cache_language_id, cache_name, cache_data, cache_global, cache_gzip, cache_method, cache_date, cache_expires) VALUES ('ca34fbe5f9a075091ad59abf02c259a7', '1', 'seo_urls_v2_products', 'rX1Lj+NKcvXev+LbjQ2YQFGvkuCVYXvpBwx7bVASS8UuSdSIUtet/vXfiXOSFCkpI1l9Z4DprlvNyGdkZMSJR27Lt+pY/v1f/uu///Nf//df/uf//uOf//3f/i//yz/+v78cqs25

    This happend when click on product or category .
    When refresh it's gone .

  2. #2
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: 1062 Duplicate entry for key 1 in table seo_cache

    MySQL MyISAM tables (I'm guessing "seo_cache" is a MyISAM table) do not typically provide full ACID compliance. In particular they typically lack support for atomic read / write or transactions...

    Basically one thread is trying to update an entry which already exists. This can happen if your webserver is running PHP multithreaded and two separate threads check if the entry exists at the same time... Both see it does not exist in the database... And both try to write the new entry. The slower the servers (and higher the website load), the higher the chance this can happen.

    On "refresh" the error disappears because the entry is already in "seo_cache". The code reads the entry from the cache, finds the entry is not stale (old - based upon a timestamp), and uses the cache entry. Then if it needs to update the entry it uses a SQL "update" not an "insert".

    Some thoughts:
    • You can check if the alternative URL generation module you are using is the latest version (some optimizations might be present in newer versions to reduce the risk).
    • If you have Query Cache installed, make sure your alternative URL generation module knows about Query Cache and disables Query Cache from trying to cache requests to "seo_cache".
    • You can also try doing a "repair" on the table "seo_cache". While uncommon, sometimes the database tables can become corrupt (and thus perform poorly - or act up).
    • You could configure (or ask your server admin) to use a single threaded PHP... But this may have a negative performance impact.
    • Disable the alternative URL generation module from using a SQL cache. This will cause the "seo_table" to not be used.
    Last edited by lhungil; 8 Jul 2013 at 04:56 AM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

 

 

Similar Threads

  1. Replies: 6
    Last Post: 30 Dec 2008, 12:49 AM
  2. 1062 duplicate entry 51 for key 1 (customers_info table)
    By heavenlynights in forum Upgrading from 1.3.x to 1.3.9
    Replies: 13
    Last Post: 8 Dec 2008, 02:03 PM
  3. Replies: 2
    Last Post: 28 Nov 2008, 12:45 PM
  4. Replies: 5
    Last Post: 8 Apr 2008, 02:52 PM

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