morad kablaoui Posted December 20, 2023 Share Posted December 20, 2023 Good morning, I have just noticed that my "ns_guest" table has become huge, which makes it impossible for me to add any products or pictures. By searching the forum, most of the contributors say that this table is used for statistics and we can empty it without any problem. Is there a correct way to empty it without affecting the site? Thanks in advance. Vidéo sans titre ‐ Réalisée avec Clipchamp.mp4 Link to comment Share on other sites More sharing options...
ComGrafPL Posted December 20, 2023 Share Posted December 20, 2023 You can test modules like https://www.sunnytoo.com/product/prestashop-database-cleaner-module https://www.rolige.com/en/prestashop-modules/free/prestashop-database-cleaner-extra-32.html Link to comment Share on other sites More sharing options...
Nickz Posted December 20, 2023 Share Posted December 20, 2023 Who are you hosting with? And what are your specs, how much memory do you have, how much is allocated for services? Link to comment Share on other sites More sharing options...
ps8modules Posted December 20, 2023 Share Posted December 20, 2023 1 hour ago, morad kablaoui said: Good morning, I have just noticed that my "ns_guest" table has become huge, which makes it impossible for me to add any products or pictures. By searching the forum, most of the contributors say that this table is used for statistics and we can empty it without any problem. Is there a correct way to empty it without affecting the site? Thanks in advance. Vidéo sans titre ‐ Réalisée avec Clipchamp.mp4 Hi. You can run a few commands in the database and you're done. Information about the Prestashop version and the table prefix is missing here. Then I can give you the commands to run in phpMyAdmin. Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 21, 2023 Author Share Posted December 21, 2023 23 hours ago, Nickz said: Who are you hosting with? And what are your specs, how much memory do you have, how much is allocated for services? i have prestashop 1.7.3.3 Link to comment Share on other sites More sharing options...
Daresh Posted December 21, 2023 Share Posted December 21, 2023 Check out the Tidy module. You can set it up to clean old data from various tables as a CRON task. Your store will keep itself clean automatically. Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 21, 2023 Author Share Posted December 21, 2023 i have old version of prestashop 1.7.3.3 and ican't install any module Link to comment Share on other sites More sharing options...
Daresh Posted December 21, 2023 Share Posted December 21, 2023 PrestaShop version should have nothing to do with being able or not to install a module. What happens when you try to install anything? Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 21, 2023 Author Share Posted December 21, 2023 (edited) 4 minutes ago, Daresh said: PrestaShop version should have nothing to do with being able or not to install a module. What happens when you try to install anything? he told me I couldn't do that, and now I can't open my dashboard i try to log in with all accounts and not logging in he told me that "The Employee does not exist, or the password provided is incorrect." Edited December 21, 2023 by morad kablaoui (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted December 21, 2023 Share Posted December 21, 2023 3 hours ago, Daresh said: PrestaShop version should have nothing to do with being able or not to install a module. What happens when you try to install anything? Note that it has a full database and therefore cannot write anything from the module's configuration. You advise complete nonsense and you are responsible for the damage, since you recommended it. If the interviewer answered me, he might have problems. Link to comment Share on other sites More sharing options...
ps8modules Posted December 21, 2023 Share Posted December 21, 2023 3 hours ago, morad kablaoui said: he told me I couldn't do that, and now I can't open my dashboard i try to log in with all accounts and not logging in he told me that "The Employee does not exist, or the password provided is incorrect." You've gotten to the point where you're going to have to pay a developer to help you fix everything. Link to comment Share on other sites More sharing options...
Daresh Posted December 21, 2023 Share Posted December 21, 2023 Indeed, if the database is full you may have some issues logging in. What you can try, is to clear the search index manually. It is also often a lot of data. It can be rebuilt manually after you gain some additional space. It's _search_index and _search_word tables. Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 13 hours ago, Daresh said: Indeed, if the database is full you may have some issues logging in. What you can try, is to clear the search index manually. It is also often a lot of data. It can be rebuilt manually after you gain some additional space. It's _search_index and _search_word tables. When I search in phpmyadmin, I find a table called "ns_guest" it is very large, can I drop it ? Link to comment Share on other sites More sharing options...
Daresh Posted December 22, 2023 Share Posted December 22, 2023 If anything, truncate don't drop. Cleaning this table may casue a little issues, like not loading carts to customers who log in to their accounts etc. Link to comment Share on other sites More sharing options...
ps8modules Posted December 22, 2023 Share Posted December 22, 2023 (edited) TRUNCATE TABLE `ns_guest`; /* delete CONNECTIONS records younger than 2023-01-01 */ DELETE FROM `ns_connections` WHERE `date_add` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_page` WHERE `time_start` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_source` WHERE `date_add` < '2023-01-01 00:00:00'; /* delete LOG records younger than 2023-01-01 */ DELETE FROM `ns_log` WHERE `date_add` < '2023-01-01 00:00:00'; /* delete PAGE NOT FOUND records younger than 2023-01-01*/ DELETE FROM `ns_pagenotfound` WHERE `date_add` < '2023-01-01 00:00:00'; Edited December 22, 2023 by ps8moduly.cz (see edit history) Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 14 minutes ago, Daresh said: If anything, truncate don't drop. Cleaning this table may casue a little issues, like not loading carts to customers who log in to their accounts etc. so what can i do ? Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 14 minutes ago, ps8moduly.cz said: TRUNCATE TABLE `ns_guest`; /* delete records younger than 2023-01-01 */ DELETE FROM `ns_connections` WHERE `date_add` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_page` WHERE `time_start` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_source` WHERE `date_add` < '2023-01-01 00:00:00'; when I well use this? Link to comment Share on other sites More sharing options...
ps8modules Posted December 22, 2023 Share Posted December 22, 2023 You do not have to worry. Copy, paste into your phpMyAdmin SQL and execute the command. Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 2 minutes ago, ps8moduly.cz said: You do not have to worry. Copy, paste into your phpMyAdmin SQL and execute the command. This will not delete anything necessary, given that the site has been operating for more than ten years Link to comment Share on other sites More sharing options...
ps8modules Posted December 22, 2023 Share Posted December 22, 2023 (edited) And you need to know who joined your e-shop ten years ago and what pages they visited? Do you want to have a partially optimized database? Do you need to write to the database? Older records need to be deleted! The commands I gave you here are also included in various modules for cleaning the database. You can, of course, adjust the date in SQL. Edited December 22, 2023 by ps8moduly.cz (see edit history) Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 1 minute ago, ps8moduly.cz said: And you need to know who joined your e-shop ten years ago and what pages they visited? no hahaha tell me i can change in this SQL code to delet just older users Link to comment Share on other sites More sharing options...
Daresh Posted December 22, 2023 Share Posted December 22, 2023 That's why I recommend deleting only old data, not all data. Some users complain that after clearing the guest table totally, the carts are not loaded. Loading carts may depend on the guest table (depending on PrestaShop version, I don't remember it now exactly). I would modify the above queries this way: DELETE FROM `ns_connections` WHERE `date_add` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_page` WHERE `time_start` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_source` WHERE `date_add` < '2023-01-01 00:00:00'; DELETE FROM `ns_guest` WHERE `id_guest` NOT IN (SELECT `id_guest` FROM `ns_connections`) AND `id_customer` = 0 Link to comment Share on other sites More sharing options...
ps8modules Posted December 22, 2023 Share Posted December 22, 2023 You can edit your SQL and delete only guests. DELETE FROM `ns_guest` WHERE id_customer = '0'; Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 8 minutes ago, Daresh said: That's why I recommend deleting only old data, not all data. Some users complain that after clearing the guest table totally, the carts are not loaded. Loading carts may depend on the guest table (depending on PrestaShop version, I don't remember it now exactly). I would modify the above queries this way: DELETE FROM `ns_connections` WHERE `date_add` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_page` WHERE `time_start` < '2023-01-01 00:00:00'; DELETE FROM `ns_connections_source` WHERE `date_add` < '2023-01-01 00:00:00'; DELETE FROM `ns_guest` WHERE `id_guest` NOT IN (SELECT `id_guest` FROM `ns_connections`) AND `id_customer` = 0 Guys, can you explain to me exactly what this SQL code does, and sorry for the inconvenience Link to comment Share on other sites More sharing options...
Daresh Posted December 22, 2023 Share Posted December 22, 2023 It deletes old data related to various statistics about customers visiting your shop. Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 3 minutes ago, Daresh said: It deletes old data related to various statistics about customers visiting your shop. Okay, thank you. I noticed that there is a date. Will you erase the data down to that date? Link to comment Share on other sites More sharing options...
morad kablaoui Posted December 22, 2023 Author Share Posted December 22, 2023 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