Jump to content

Languages remain in db after removing from presta back office


Recommended Posts

Im currently undergoing  a variety of adds/edits/removals in order to speed up my store which has 11,000 or so products.  

 

I have removed all un-required languages ( 4 of them ) in back office > localization > languages

Message shows:

When you delete a language, all related translations in the database will be deleted. 

 

However it seems

In phpMyAdmin, the additional languages are still there.

It seems when you add an additional language pack you are adding masses of values into the db.  Im far from expert this deep but if something has to sift through 1,138,861 rows instead of a fifth of that surely the result will take more time.

ebay was another module i un-installed from presta bo, which remained in the db, this was all easy to remove though.

 

How do i remove the additional languages from the db?

something is really slowing the site down, I'm trying everything i can to find the issue/s

Any help advice would be much appreciated

Edited by SiteOwnerPrestaUser (see edit history)
Link to comment
Share on other sites

  • 6 months later...

I really would like to find a solution for this aswell.

 

I have 2 languages and want to delete one of them. I delete it in the backoffice and its gone there, but in the MySQL Database are still plenty of leftovers for that languages. I would like to delete everything related to this languages. So I thought the solution must be to have a SQL query that goes through every table and deletes every row with the id_lang value of "2". Anyone any idea how that is possible.

 

And then I would like to be able to have the next new installed language to take the id "2" so i simple change the auto increment value in the ps_lang table to start from "1" i guess.?

Link to comment
Share on other sites

if deleted from shop, then logic is not going to read them.  so in essence from a speed stand point simply disabling a language is sufficient.

 

to manually delete them is not recommended, as most likely break something.

 

if you think that it should also be deleted from db, then I suggest opening a forge report (bug), post it back here so other can follow/comment/vote up.

 

http://forge.prestashop.com/

 

thanks!

Link to comment
Share on other sites

Thanks El Patron

 

I understand its difficult to achieve but I think it should be standard that the software maintains a clean database to ensure best possible performance.

Any way I will take your advice and open a forge report and see what happens. (Its obviously not an urgent issue :D)

 

In the meantime: Anyone able to create a script that deletes every row with id_lang "x" in all tables?

I am able to delete them from a single table but it would be amazing to have it fully automatic for the whole database.

Edited by thepan (see edit history)
Link to comment
Share on other sites

Thanks El Patron

 

I understand its difficult to achieve but I think it should be standard that the software maintains a clean database to ensure best possible performance.

Any way I will take your advice and open a forge report and see what happens. (Its obviously not an urgent issue :D)

 

In the meantime: Anyone able to create a script that deletes every row with id_lang "x" in all tables?

I am able to delete them from a single table but it would be amazing to have it fully automatic for the whole database.

 

I do not disagree, what I am saying is if you feel strongly enough about it, and don't want to 'fry' your shop, which you will, unless of course this is just a hobby, then open forge report....that is my recommendation.

if deleted from shop, then logic is not going to read them.  so in essence from a speed stand point simply disabling a language is sufficient.

 

to manually delete them is not recommended, as most likely break something.

 

if you think that it should also be deleted from db, then I suggest opening a forge report (bug), post it back here so other can follow/comment/vote up.

 

http://forge.prestashop.com/

 

thanks!

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Hi there!

 

Same problem here!

 

I had to clean the db by hand in order to get rid of all of the garbage!!

 

This is how i did it:

==============

 

1.- First of all, I did a full backup of the database, which you should do it too, just in case!

 

2.- I listed all of the tables in Prestashop which contains translations with this SQL query:

 

SHOW TABLES IN my_database_name LIKE '%_lang';

 

3.- Then, I created a SQL Delete query for all and each of the "_lang" table names listed.

 

*** Please, note that in my case I wanted to delete all of the records whose language id (id_lang) was NOT "1" and was NOT "3" ***

 

In order to know which language ids you want to preserve, go to "Localization -> Languages" and write down the ids which appear under the "ID" column. In my case, those values were 1 and 3 as stated before.

 

So, these were my queries:

 

DELETE FROM ps_advice_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_attachment_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_attribute_group_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_attribute_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_badge_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_btmegamenu_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_carrier_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_cart_rule_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_category_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_cms_block_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_cms_category_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_cms_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_configuration_kpi_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_configuration_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_contact_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_country_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_customization_field_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_feature_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_feature_value_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_gender_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_group_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_homeslider_slides_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_image_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_info_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_leoblog_blog_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_leoblogcat_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_leosliderlayer_slides_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_linksmenutop_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_manufacturer_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_meta_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_order_message_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_order_return_state_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_order_state_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_product_comment_criterion_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_product_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_profile_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_quick_access_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_risk_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_scene_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_stock_mvt_reason_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_supplier_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_supply_order_state_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_tab_lang  WHERE id_lang != 1 AND id_lang != 3;
DELETE FROM ps_tax_lang  WHERE id_lang != 1 AND id_lang != 3;

COMMIT;

 

 

4.- That´s all! Hope you enjoy it!

 

 

Be water my friend!

Link to comment
Share on other sites

  • 1 year later...

I have found this problem too and it 

 

if deleted from shop, then logic is not going to read them.  so in essence from a speed stand point simply disabling a language is sufficient.

 

to manually delete them is not recommended, as most likely break something.

 

if you think that it should also be deleted from db, then I suggest opening a forge report (bug), post it back here so other can follow/comment/vote up.

 

http://forge.prestashop.com/

 

thanks!

Hello El Patron, I came across this issuee too and it made me think that multiplying the text of one language by 3 must to add weight to a database. I don´t really understand why it is not going to slow the website with this extra baggage, but my knowledge is not near yours. Have they found a "safe" solution for this by now? I see that the last post for this topic is more than a year ago...

Thank you for your contribution to this forum and to the prestashop community!

Cheers!

Edited by De La Riviere (see edit history)
Link to comment
Share on other sites

Hi there!

 

Same problem here!

 

I had to clean the db by hand in order to get rid of all of the garbage!!

 

This is how i did it:

==============

 

1.- First of all, I did a full backup of the database, which you should do it too, just in case!

 

2.- I listed all of the tables in Prestashop which contains translations with this SQL query:

 

SHOW TABLES IN my_database_name LIKE '%_lang';

 

3.- Then, I created a SQL Delete query for all and each of the "_lang" table names listed.

 

*** Please, note that in my case I wanted to delete all of the records whose language id (id_lang) was NOT "1" and was NOT "3" ***

 

In order to know which language ids you want to preserve, go to "Localization -> Languages" and write down the ids which appear under the "ID" column. In my case, those values were 1 and 3 as stated before.

 

So, these were my queries:

 

DELETE FROM ps_advice_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_attachment_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_attribute_group_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_attribute_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_badge_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_btmegamenu_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_carrier_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_cart_rule_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_category_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_cms_block_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_cms_category_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_cms_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_configuration_kpi_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_configuration_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_contact_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_country_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_customization_field_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_feature_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_feature_value_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_gender_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_group_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_homeslider_slides_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_image_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_info_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_leoblog_blog_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_leoblogcat_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_leosliderlayer_slides_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_linksmenutop_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_manufacturer_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_meta_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_order_message_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_order_return_state_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_order_state_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_product_comment_criterion_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_product_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_profile_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_quick_access_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_risk_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_scene_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_stock_mvt_reason_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_supplier_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_supply_order_state_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_tab_lang  WHERE id_lang != 1 AND id_lang != 3;

DELETE FROM ps_tax_lang  WHERE id_lang != 1 AND id_lang != 3;

COMMIT;

 

 

4.- That´s all! Hope you enjoy it!

 

 

Be water my friend!

This is flawed.  While you have deleted all the records in the *_lang tables where the language ID is not 1 or 3, you have failed to account for records in every other table that references id_lang whose records are 1 and 3.

 

For example, ps_cart

Link to comment
Share on other sites

I have found this problem too and it 

 

Hello El Patron, I came across this issuee too and it made me think that multiplying the text of one language by 3 must to add weight to a database. I don´t really understand why it is not going to slow the website with this extra baggage, but my knowledge is not near yours. Have they found a "safe" solution for this by now? I see that the last post for this topic is more than a year ago...

Thank you for your contribution to this forum and to the prestashop community!

Cheers!

database engines are designed to hold massive amounts of records.  indexes are what keep a small and large database efficient and responsive. 

 

so in theory, a database table with 1 record and with 1 million records should provide the same result response time.  this assumes that the database and the application are also designed properly, and that you are not trying to return ALL of the records in the table, and that you are not performing things like full table scans with un-indexed data (searching for a customer by their phone number, as phone number is not part of the index). 

 

think of a book, where there is an index in the back of the book (like a car manual).  if you want to know where the Fuses are in the car, go to the index, find Fuses and see the page number.  if there were no index, you would have to flip through all of the pages to find where Fuses are discussed.  which approach one is faster?  this is much how a database works.

  • Like 2
Link to comment
Share on other sites

database engines are designed to hold massive amounts of records.  indexes are what keep a small and large database efficient and responsive. 

 

so in theory, a database table with 1 record and with 1 million records should provide the same result response time.  this assumes that the database and the application are also designed properly, and that you are not trying to return ALL of the records in the table, and that you are not performing things like full table scans with un-indexed data (searching for a customer by their phone number, as phone number is not part of the index). 

 

think of a book, where there is an index in the back of the book (like a car manual).  if you want to know where the Fuses are in the car, go to the index, find Fuses and see the page number.  if there were no index, you would have to flip through all of the pages to find where Fuses are discussed.  which approach one is faster?  this is much how a database works.

Thanks for the info. 

So you mean that the id lang numbers that should not be there will not slow down the website at all?

Thanks

Link to comment
Share on other sites

first, removing the languages in the manner above is flawed, and will result foreign key constraints and other issues.  and that could lead to bigger problems, including errors and speed.

 

secondly, I see no reason to believe that a website is going to see any noticeable or measurable increase is page response by removing these unused language records. 

 

feel free to setup two identical stores on the same hardware/software with the only difference being the languages installed within Prestashop, and show us a page response difference between the 2

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...