Support » Plugin: Slimstat Analytics » duplicate key in table ‘wp_[number]_slim_events’

  • Resolved kazvorpal


    My client runs a large WordPress Multisite host with perhaps eight thousand clients (not all active, of course). About a week after installing Slimstat, new customers started getting this error during the last stage of signup for a new site:

    Insertion Error: Can’t write; duplicate key in table ‘wp_9398_slim_events’ – the template was not applied. (New Blog templates – with CREATE TABLE query for Additional Tables)

    The number in the middle of the table name varies, presumably it’s the unique table being created for that new user.

    Deleting and reinstalling Slimstat works, but of course resets the stats, and in under a week the problem comes back.

    They’re using WordPress 4.5.1 and MySQL version 5.7.11-4-log, and can’t upgrade because they errantly modded the code directly.

    • This topic was modified 2 years, 8 months ago by kazvorpal.
    • This topic was modified 2 years, 8 months ago by kazvorpal.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jason Crouse



    according to StackOverflow, this might be caused by a conflict in constraint IDs:

    What version of Slimstat are you currently using? Could you check what the constraint names for the two Slimstat tables are, for newly created sites?

    Thank you,

    Thanks for responding, I really need to get this straightened out.

    It’s Slimstat

    The exact table for a given error does not end up existing in the database. For example, I just tried to make an account right now, and got this:

    Insertion Error: Can’t write; duplicate key in table ‘wp_9485_slim_events’ – The template was not applied. (New Blog Templates – With CREATE TABLE query for Additional Tables)

    So I ran this:

    mysql> SHOW CREATE TABLE wp_9485_slim_events;
    ERROR 1146 (42S02): Table ‘i687418_wp1.wp_9485_slim_events’ doesn’t exist

    So the error appears to prevent the actual creation of the table, or else the table gets unmade during the problem.

    Here’s the dump of a typical slim_events table that does exist for a user created during the times when the error is not manifesting:

    | wp_1055_slim_events | CREATE TABLE wp_1055_slim_events (
    event_id int(10) NOT NULL AUTO_INCREMENT,
    type tinyint(3) unsigned DEFAULT ‘0’,
    event_description varchar(64) DEFAULT NULL,
    notes varchar(256) DEFAULT NULL,
    position varchar(32) DEFAULT NULL,
    id int(10) unsigned NOT NULL DEFAULT ‘0’,
    dt int(10) unsigned DEFAULT ‘0’,
    PRIMARY KEY (event_id),
    KEY idx_wp_1055_slim_stat_events (dt),
    KEY fk_wp_1055_slim_events_id (id),
    CONSTRAINT fk_wp_1055_slim_events_id FOREIGN KEY (id) REFERENCES wp_1055_slim_stats (id) ON DELETE CASCADE ON UPDATE CASCADE

    Plugin Author Jason Crouse


    As you can see, all the key names are unique qs they use the blog_id for the current site. So that’s why I don’t understand what the issue is for your specific situation. I wonder if there’s something else interfering with the table creation function that Slimstat calls when a new blog is setup. Maybe a conflict with another plugin?

    Many of the searches for this error in Google point out to WPMUDEV articles, so I’m wondering if that would be the reason for your problem:

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘duplicate key in table ‘wp_[number]_slim_events’’ is closed to new replies.