Title: Total Views 1 Issue
Last modified: September 9, 2018

---

# Total Views 1 Issue

 *  Resolved [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/total-views-1-issue/)
 * Hi,
 * I’ve noticed this for some time, but the “Total Views” at the bottom of each 
   page shows up as “1.” Older posts show higher counts, but those numbers are frozen.
   I saw a post here from eight months ago on this issue, but I didn’t see anyone
   say their issue was fixed.
 * I did use the plugin’s tools to “Recreate Primary Key” in the hopes this would
   fix things (as suggested in that other thread). Also, I changed the tracker type
   from “Ajaxurl based” to “Query variable based” as also suggested in that other
   thread.
 * It isn’t that big a deal, but I am kinda curious about it and wouldn’t mind if
   it gets fixed. Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftotal-views-1-issue%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/total-views-1-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/total-views-1-issue/page/2/?output_format=md)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10671145)
 * I think something broke down in the database during the upgrades, as this has
   been a recurring issue.
 * Can you change that to Query variable based so I can take a look at your site.
   Also, worth checking your database to see what the structures of the primary 
   keys are as something that button doesn’t work (I’m not sure why as it has worked
   in all my tests)
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10671375)
 * Query variable based is set (or should be).
 * > Also, worth checking your database to see what the structures of the primary
   > keys are as something that button doesn’t work (I’m not sure why as it has 
   > worked in all my tests)
 * I’m somewhat ignorant in MySQL, so how would I determine this?
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10674475)
 * If you have access to phpMyAdmin when you browse the Structure of the table you
   can see the various indexes at the bottom of the table – see the wp_top_ten and
   wp_top_ten_daily tables in your database.
 * The primary keys will be “postnumber, blog_id” and “postnumber, dp_date, blog_id”
   respectively.
 * What you can do is run this query in the database if not present.
 *     ```
       ALTER TABLE wp_top_ten DROP PRIMARY KEY;
       ALTER TABLE wp_top_ten_daily DROP PRIMARY KEY;
       ALTER TABLE wp_top_ten ADD PRIMARY KEY(postnumber, blog_id);
       ALTER TABLE wp_top_ten_daily ADD PRIMARY KEY(postnumber, dp_date, blog_id); 
       ```
   
 * Always backup your database before doing any major changes just to be safe.
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10683064)
 * Sorry for the delay.
 * > If you have access to phpMyAdmin when you browse the Structure of the table
   you can see the various indexes at the bottom of the table – see the wp_top_ten
   and wp_top_ten_daily tables in your database.
 * Under “Indexes” for “wp_<some_ID>_top_ten it is saying, “No index defined!”
 * For wp_<some_ID>_top_ten_daily, it says the keyname is PRIMARY and the type is
   BTREE.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10691662)
 * Can you please use the above code but change it to the correct table names.
 * More importantly do you see only the wp_top_ten tables or you see a lot of these
   with similar names. If so it might be the old issue of the tables not being upgraded
   from older versions of the plugin.
 * Note the wp might be something else
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10716575)
 * The two tables I mentioned are all that’s out there. I’ll have to run those commands,
   once I figure out how to do that. (Never manually done SQL commands for my site.)
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10735370)
 * If you’re in phpMyAdmin, you can run the queries there. see this tutorial [https://www.siteground.com/tutorials/phpmyadmin/query/](https://www.siteground.com/tutorials/phpmyadmin/query/)
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10824667)
 * > Error
   > SQL query:
   > ALTER TABLE `wp_XXXXX_top_ten` DROP PRIMARY KEY
   > MySQL said: Documentation
   >  #1091 – Can’t DROP ‘PRIMARY’; check that column/
   > key exists
 * Remember what I said before.
 * > Under “Indexes” for “wp_<some_ID>_top_ten it is saying, “No index defined!”
 * And then there’s this.
 * > Error
   > SQL query:
   > ALTER TABLE `wp_XXXXX_top_ten` ADD PRIMARY KEY(postnumber, dp_date, blog_id)
   > MySQL said: Documentation
   >  #1072 – Key column ‘dp_date’ doesn’t exist in table
    -  This reply was modified 7 years, 7 months ago by [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/).
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10824683)
 * For the wp_XXXXX_top_ten_daily table, the DROP PRIMARY KEY worked (I didn’t grab
   the text for that).
 * > Error
   > SQL query:
   > ALTER TABLE `wp_XXXXX_top_ten_daily` ADD PRIMARY KEY(postnumber, blog_id)
   > MySQL said: Documentation
   >  #1062 – Duplicate entry ‘16417-1’ for key ‘PRIMARY’
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10836467)
 * Still no changes in Visit times, though the Daily Visit count still seems right.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10837028)
 * Can you please run
 * `ALTER TABLE wp_XXXXX_top_ten ADD PRIMARY KEY(postnumber, blog_id)`
 * The dp_date only applies to the daily table.
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10839206)
 * > Error
   > SQL query:
   > ALTER TABLE `wp_XXXXX_top_ten` ADD PRIMARY KEY(postnumber, blog_id)
   > MySQL said: Documentation
   >  #1062 – Duplicate entry ‘20640-1’ for key ‘PRIMARY’
    -  This reply was modified 7 years, 7 months ago by [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/).
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10839220)
 * That’s weird that it is coming up with an error for duplicate entry when I couldn’t
   drop the PRIMARY key since it supposedly didn’t exist. (But then my SQL knowledge
   is limited to having a vague understanding of what the commands you gave me are
   doing within the database.)
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10843936)
 * Are you using phpMyAdmin? If so, you can drop the indices directly from the interface.
 * If you’re browsing the Structure of the table and scroll down to the bottom and
   remove it from there:
 * [https://stackoverflow.com/questions/4320005/phpmyadmin-removing-an-index](https://stackoverflow.com/questions/4320005/phpmyadmin-removing-an-index)
 *  Thread Starter [AstroNerdBoy](https://wordpress.org/support/users/astronerdboy/)
 * (@astronerdboy)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/#post-10845471)
 * If I click the wp_xxxxx_top_ten table link, a warning appears at the top of the
   page for the table.
 * >  Current selection does not contain a unique column. Grid edit, checkbox, Edit,
   > Copy and Delete features are not available. Documentation
 * There’s no option for dropping the table. There is an option from the list of
   all tables.
 * I clicked that and the table is gone. Ooops. So I just deactivated and reactivated
   the plugin. That restored the table. Of course it was completely empty, but the
   table is now working. There are no longer warnings and there is a drop element
   as well.
 * To be honest, I think the table had become unusable. As I had mentioned before,
   there was no PRIMARY key when I previously looked in phpMyAdmin. And this table
   always generated warnings when looking at structure or anything else. So what
   I did may have been the only solution unless there was a way to add the key. 
   But I think that was what you were having me attempt before, right?
 * In completely dropping the table, I lost total counts, but I was never going 
   to have true total counts because (1) I installed this plugin quite some time
   after the blog started and (2) I had run a cleanup on the table (via the automated
   tools in the plugin) to trim it back. So I’m not going to worry about that.

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/total-views-1-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/total-views-1-issue/page/2/?output_format=md)

The topic ‘Total Views 1 Issue’ is closed to new replies.

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

 * 18 replies
 * 2 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/total-views-1-issue/page/2/#post-10862999)
 * Status: resolved