Answer the question
In order to leave comments, you need to log in
How to stop the "growth" of b_sale_viewed_product in Bitrix 17?
Greetings!
In general, the site on Bitrix is version 17 with a database weight of 17! gigabyte. The main (but not the only) problem is the table "b_sale_viewed_product" (13GB).
Judging by the site visit logs (server access_log), Yandex bot traverses the site throughout the day and indexes links. At this time, Bitrix writes all visited URLs to this table. Speed ~ 30 records per table/sec.
In the site settings, parameters have already been set that limit the amount of everything in general, while nothing was deleted from the database. The agent responsible for cleaning is present, but does not automatically work. How to kick it "manually", I do not know.
Question? How can I limit the write to this table so that it is within reason?
Help out, guys (and girls, there are probably those :)
Thank you!
Answer the question
In order to leave comments, you need to log in
Perhaps in the settings of the IM module there is not an adequate storage time for viewed products.
Also try clearing the table and see how quickly it will fill up again.
https://thisis-blog.ru/problema-razdutiya-tablic-b...
You can generally turn off saving data to this table in the MI module. The setting is called "Save viewed catalog items"
This table stores the viewed products of users.
In the settings of the "Online store" module, it is possible to change the "Storage time of viewed products (days)" and "Maximum number of viewed products of the user".
public function _ClearViewed()
{
global $DB;
$viewed_time = COption::GetOptionString("sale", "viewed_time", "90");
$viewed_time = IntVal($viewed_time);
$strSql =
"DELETE ".
"FROM b_sale_viewed_product ".
"WHERE TO_DAYS(DATE_VISIT) < (TO_DAYS(NOW()) - ".$viewed_time.") LIMIT 1000"; $db_res = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__);
return true;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question