Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/styllloz/public_html/qa-include/qa-base.php on line 1175

Warning: session_start(): Cannot start session when headers already sent in /home/styllloz/public_html/qa-include/app/users.php on line 162

Warning: Cannot modify header information - headers already sent by (output started at /home/styllloz/public_html/qa-include/qa-base.php:1175) in /home/styllloz/public_html/qa-include/app/users.php on line 1267

Warning: Cannot modify header information - headers already sent by (output started at /home/styllloz/public_html/qa-include/qa-base.php:1175) in /home/styllloz/public_html/qa-include/app/page.php on line 356
How to optimize the database query in Bitrix? - code-flow.club | Q&A

How to optimize the database query in Bitrix?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
17 views
There is an info Block which logs the clicks when you navigate to certain pages.
There were more than 600 thousand records.
Now when you output the elements of this IB in the admin panel,you receive the Error
https://drive.google.com/file/d/1ysZguqoAHI0vznnrp...
In addition at the front ,is the conclusion of this data for statistics
The admin server says that there is an overload of the server and describes it

SELECT FPS0.PROPERTY_46 as PROPERTY_SUMM_VALUE, concat(BE.ID , ‘:’ , 46) as PROPERTY_SUMM_VALUE_ID,DATE_FORMAT(BE.DATE_CREATE, ‘%d.%m.%Y %H:%i:%s’) as DATE_CREATE \\SELECT FPS0.PROPERTY_46 as PROPERTY_SUMM_VALUE, concat(BE.ID , ‘:’ , 46) as PROPERTY_SUMM_VALUE_ID,DATE_FORMAT(BE.DATE_CREATE, ‘%d.%m.%Y %H:%i:%s’) as DATE_CREATE \\ FROM b_iblock B INNER JOIN b_lang L ON B. LID=L. LID INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B. ID INNER JOIN b_iblock_element_prop_s9 FPS0 ON FPS0.IBLOCK_ELEMENT_ID = BE.ID
WHERE 1=1 AND ( ((((BE.IBLOCK_ID = ‘9’)))) AND ((((BE.DATE_CREATE > ‘2017-09-07 14:13:38’)))) AND ((((FPS0.PROPERTY_48 = ‘903022’)))) ) AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)));”
the types of request vypolnyaetsya 4 seconds, such in show proccess thread ~ 30.
explain query
“id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE B const PRIMARY PRIMARY 4 const 1 1 SIMPLE L const PRIMARY PRIMARY 2 const 1 Using index
BE 1 SIMPLE ref PRIMARY,ix_iblock_element_1,ix_iblock_element_4,ix_iblock_element_3,ix_iblock_element_code ix_iblock_element_1 663290 const 4 Using where
1 SIMPLE FPS0 eq_ref PRIMARY PRIMARY 4 bitrix_81.BE.ID 1 Using where”

apparently this happens when
go to the front
How to decide to avoid overload,and of errors in the Admin
by | 17 views

1 Answer

0 like 0 dislike
To optimize the query is a wrong formulation of the question. To reduce the load on the server based on the information that you have provided admin, you must:
find Bitrix api, I generate this query
find a place on your site: component or just the code on the page where the API is invoked
- to see if her call in a loop for an unknown number of elements, keep in mind that the cycle may not be obvious if, for example, calling this API is in the file, which twitches in a loop via ajax
to make the API for the cycle, how to do it read the book "code complete" by Steve McConnell - this is a gorgeous book that always helps me in such situations.
- wrap the cache the place where the call to this API
- check that the cache is working as it should
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked Apr 9, 2019 by victorib_us
0 like 0 dislike
4 answers
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
asked Apr 10, 2019 by ArturAralin
110,608 questions
257,186 answers
0 comments
35,181 users