Title: WordPress database error Duplicate entry
Last modified: August 22, 2016

---

# WordPress database error Duplicate entry

 *  [Lea](https://wordpress.org/support/users/leac/)
 * (@leac)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/)
 * Hi Hector
 * For the past few days, I’ve been seeing this error in my site’s log file:
 * [18-Dec-2014 23:59:04] WordPress database error Duplicate entry ‘23248’ for key‘
   PRIMARY’ for query INSERT INTO wp_popularpostssummary
    (postid, pageviews, view_date,
   last_viewed) VALUES (16774, 1, ‘2014-12-19’, ‘2014-12-19 01:59:04’) ON DUPLICATE
   KEY UPDATE pageviews = pageviews + 1, last_viewed = ‘2014-12-19 01:59:04’; made
   by do_action(‘wp_ajax_nopriv_update_views_ajax’), call_user_func_array, WordPressPopularPosts-
   >update_views_ajax, WordPressPopularPosts->__update_views
 * [https://wordpress.org/plugins/wordpress-popular-posts/](https://wordpress.org/plugins/wordpress-popular-posts/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593155)
 * Hi Lea,
 * I’m unable to reproduce this. Is it the exact same error (same key, post ID, 
   etc)?
 *  Thread Starter [Lea](https://wordpress.org/support/users/leac/)
 * (@leac)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593164)
 * Hi Héctor
 * It’s almost the exact same error. The entry is always ‘23248’, but the first 
   value in parenthesis is different:
    `VALUES (15263, 1, '2014-12-17', '2014-12-
   17 22:30:26')` `VALUES (11494, 1, '2014-12-17', '2014-12-17 22:34:53')` `VALUES(
   4660, 1, '2014-12-17', '2014-12-17 22:38:31')` and so on..
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593165)
 * Sounds like the auto increment field (_ID_) in your _wp\_popularpostssummary_
   table has been messed up / disabled. Could you please check that?
 *  Thread Starter [Lea](https://wordpress.org/support/users/leac/)
 * (@leac)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593174)
 * From what I can tell, the ID column is defined to be auto incremented, and the
   highest id is 23247.
 * How can I know if it’s messed up or disabled?
 *  Thread Starter [Lea](https://wordpress.org/support/users/leac/)
 * (@leac)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593177)
 * I might have found a solution. I just want to wait a bit to make sure, and then
   I’ll come here and update.
    Thank you for helping me identify the problem.
 *  Thread Starter [Lea](https://wordpress.org/support/users/leac/)
 * (@leac)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593262)
 * The solution I found was this:
    I edited the `wp_popularpostssummary` table to
   remove the auto increment from the ID column, then immediately edited it to add
   it back. That returned the table to normal. In the past 2 months, this error 
   has returned twice, and both times this is the solution I applied and it worked.
   I don’t know what causes it to happen, so I check my error logs daily :).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593263)
 * Hi Lea!
 * Thanks for the input! The only way I know of that an auto-increment field gets
   stuck is when it reaches its maximum defined value (BIGINT in our case, which
   should be more than enough). From what I remember, your site isn’t _that_ large(
   unless something has changed during the past few months hehe).
 * I’ll do some research and see what I can find.
 *  Thread Starter [Lea](https://wordpress.org/support/users/leac/)
 * (@leac)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593264)
 * No, my site isn’t _that_ large 🙂
    And I can see what the number it’s getting
   stuck on, and it’s far from BIGINT… Thank you very much for researching.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘WordPress database error Duplicate entry’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

## Tags

 * [Database Error](https://wordpress.org/support/topic-tag/database-error/)

 * 8 replies
 * 2 participants
 * Last reply from: [Lea](https://wordpress.org/support/users/leac/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-database-error-duplicate-entry-4/#post-5593264)
 * Status: not resolved