bhargav1991 Posted July 6, 2017 Share Posted July 6, 2017 I want to cleanup the database and start a fresh. I truncated all the tables Accordingly. Suppose i want to cleanup all customer data i truncated all the tables which were referring id_customer field which is a primary key in customer table. But when i add a customer the indexing of id_customer starts randomly . Sometimes it starts with 6 sometimes 1 . And in between it skips the id , checkout the image for better understanding Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted July 6, 2017 Share Posted July 6, 2017 Hi...please use the "prestashop cleaner module" truncated prestashop dataThanks Link to comment Share on other sites More sharing options...
Scully Posted July 7, 2017 Share Posted July 7, 2017 Run this command against your database: ALTER TABLE ps_customer AUTO_INCREMENT = 1; And you have to be sure that you have truncated all tables referencing to id_customer. Link to comment Share on other sites More sharing options...
bhargav1991 Posted July 8, 2017 Author Share Posted July 8, 2017 Run this command against your database: ALTER TABLE ps_customer AUTO_INCREMENT = 1; And you have to be sure that you have truncated all tables referencing to id_customer. Already tried that, the issue seems to be clustered environment. I have 3 mysql servers clustered. Surprisingly when i change the engine from innodb to myisam the indexing seems to be working properly Link to comment Share on other sites More sharing options...
Scully Posted July 9, 2017 Share Posted July 9, 2017 (edited) The missing information in the first part was that you use a MySQL cluster. Auto increment does not work the same way with clustered database compared to a single instance setup. In clustered environment, each cluster prefetches some auto increment values specifically and only used for this cluster. For example: Cluster 1 gets auto increment 1-5 Cluster 2 gets auto increment 5-10 Cluster 3 gets auto increment 11-15 Depending on which cluster is processing the request, the auto incr may be different. This is intended by design and not a bug. It helps to avoid inconsistencies with auto increment values when insert commands are processes in parallel on the same tables. Edited July 9, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now