Optimizing 1C-Bitrix Infoblock Queries: Speed Up Your Catalog
Real Problem: Slow Infoblock Queries
We often encounter projects where the Bitrix catalog slows down due to non-optimal infoblock queries. Typical scenario: a product listing page with 48 items takes 2-3 seconds to load, even when the MySQL server is not overloaded. The standard CIBlockElement::GetList with property filtering generates multiple JOINs, and with 100 products having 5 properties each, EXPLAIN shows scans of hundreds of thousands of rows. TTFB exceeds 1 second even on a VPS with 4 vCPUs. The platform 1C-Bitrix is one of the popular CMS for e-commerce, yet its infoblocks often become a bottleneck. In our practice, with over 50 optimized projects, 90% of problems are solved by migrating to D7 ORM and properly placing indexes. This reduces server resource costs and stays within budget without extra investment. We guarantee a 3-5x reduction in query time. This article is the result of our years of experience.
Why Standard Bitrix Queries Are Slow?
The old API CIBlockElement::GetList when using PROPERTY_* filter adds a JOIN for each property. If there are 5 properties in the filter — 5 JOINs. The query plan becomes non-optimal, especially when the b_iblock_element_property table contains millions of rows. Additionally, the arSelect parameter with "*" or without an explicit list forces the API to pull all fields, including long texts like PREVIEW_TEXT and DETAIL_TEXT. As a result, the data volume from the database increases by 3-5 times.
Another common mistake is the N+1 query problem. After fetching a list of items, developers often call CIBlockElement::GetProperty() for each product in a loop. For 48 products, that's 1 + 48 = 49 queries. Execution time grows linearly.
How to Implement Batch Fetching Without Regression?
Switching to \Bitrix\Iblock\ElementTable from D7 ORM gives full control over SQL. Each query can be verified using getQuery()->getSql() before execution. Example of an optimal query for a catalog page:
use Bitrix\Iblock\ElementTable;
$result = ElementTable::getList([
'select' => [
'ID',
'NAME',
'CODE',
'PREVIEW_PICTURE',
'IBLOCK_SECTION_ID',
],
'filter' => [
'=IBLOCK_ID' => CATALOG_IBLOCK_ID,
'=ACTIVE' => 'Y',
'=IBLOCK_SECTION_ID' => $sectionId,
],
'order' => ['SORT' => 'ASC', 'ID' => 'ASC'],
'limit' => 24,
'offset' => $page * 24,
'cache' => ['ttl' => 3600],
]);
Explicit select without properties — the query hits only b_iblock_element, no JOINs. If property values are needed for multiple products, we use batch fetching by IDs:
$ids = array_column($elements, 'ID');
$propsResult = \CIBlockElement::GetPropertyValuesArray(
$ids,
CATALOG_IBLOCK_ID,
['CODE' => ['BRAND', 'COLOR', 'SIZE']]
);
This "fetch by ID in batches" pattern solves the N+1 problem. The official documentation on D7 ORM contains all the details. 1C-Bitrix Academy
Case Study from Our Practice: Construction Materials Catalog with 45,000 SKUs
We worked with a client — an online store of construction materials. The catalog contained 45,000 active items. A section page with 48 products loaded in 1.8 seconds without cache. MySQL slow query log revealed several issues:
-
CIBlockElement::GetList with SELECT => "*" and PROPERTY_FILTER on 5 properties took 640 ms per query.
- The "related products" block executed a separate query for each of the 6 items (N+1).
- The section tree query had no depth level limit.
We performed the following actions:
- Rewrote the main query to D7, leaving only 8 necessary fields.
- Replaced iterative property queries with batch fetching using
GetPropertyValuesArray.
- Limited
DEPTH_LEVEL in the section fetch and added tagged cache.
- Created a composite index on
b_iblock_element:
ALTER TABLE b_iblock_element
ADD INDEX idx_iblock_section_active_sort
(IBLOCK_ID, IBLOCK_SECTION_ID, ACTIVE, SORT);
Result: TTFB of the section page without cache dropped from 1.8 s to 380 ms, with cache — to 45 ms. The number of database queries decreased from 12 to 4. MySQL load reduced by 3 times, saving the client up to 30% on server costs. The client gained the ability to serve more visitors without increasing expenses.
Comparison of Old vs. New Approach
| Parameter |
CIBlockElement::GetList |
D7 ORM + Batches |
| JOIN count when filtering by 5 properties |
5 |
0 (if properties not in select) |
| SQL control |
No |
Full (getQuery()->getSql()) |
| N+1 risk |
High |
Eliminated by batch fetching |
| Caching |
Only file-based |
Tagged + data cache |
| Performance (example) |
640 ms |
80 ms |
D7 API is 3-5x faster for typical queries.
What's Included in the Optimization Work
We offer comprehensive infoblock query optimization turnkey. The work includes:
- Analysis of MySQL slow query log and Bitrix performance panel.
- Audit of all custom components for N+1 and non-optimal fetches.
- Rewriting critical queries to D7 ORM with explicit select and batch strategies.
- Adding necessary composite indexes and configuring tagged cache.
- Creating documentation for optimized queries for your team.
- Training developers on D7 and best practices.
More about our experience
We have been doing Bitrix development for over 10 years, certified by 1C-Bitrix. Successfully optimized catalogs for 20+ large projects with traffic from 10,000 visitors per day.
Timelines and Pricing
| Stage |
Duration |
| Query audit (slow log, Explain, Bitrix panel) |
1–2 days |
| Rework critical queries (D7, batching) |
3–7 days |
| Indexes and cache setup |
1–2 days |
| Documentation and training |
1 day |
Pricing is calculated individually based on catalog size and component count. Contact us for an evaluation of your project — it takes 2 days. Get a consultation on speeding up your catalog.
80% of Bitrix sites slow down due to one table
b_iblock_element_property is an EAV structure where each row stores one value of one property of one element. A catalog of 50,000 products with 30 properties yields 1.5 million rows. The smart filter performs a JOIN of this table with b_iblock_element on five properties, and MySQL performs a full table scan for 3–5 seconds. Our experience shows that without intervention in this table, site acceleration is impossible. We take on projects where load time has dropped to 8–10 seconds and bring TTFB back to <200 ms within 1–2 weeks. Site speed optimization begins with an audit of slow queries and ends with a comprehensive turnkey infrastructure overhaul.
Contact us for an audit — we will identify bottlenecks within 2 hours and propose a concrete plan.
How to achieve TTFB below 200 ms?
Server optimization is the first step. Nginx configuration goes beyond simple gzip. Specifically:
-
gzip_comp_level 4-5 — higher is pointless, CPU consumes more than it saves bandwidth.
-
brotli on with brotli_static on for precompressed files.
- HTTP/2 with
http2_max_concurrent_streams 128.
-
fastcgi_cache for PHP responses — caching at Nginx level, bypassing PHP-FPM entirely.
-
worker_processes auto, worker_connections according to the number of simultaneous connections.
PHP-FPM tuning: choose between pm = dynamic and pm = static. Static mode works best for dedicated servers with predictable load because it avoids forking overhead. Dynamic saves RAM under low traffic. Calculate pm.max_children as (available RAM - RAM for MySQL/Redis) / average process consumption. For OPcache set memory_consumption=256, max_accelerated_files=20000, and validate_timestamps=0 in production (restart PHP-FPM on deploy).
MySQL/MariaDB: the main bottleneck is almost always the database. Enable slow_query_log with a threshold of 0.5 sec and analyze every query via EXPLAIN. Set innodb_buffer_pool_size to 70–80% of available RAM on a dedicated server. Create composite indexes for faceted search: (IBLOCK_ID, IBLOCK_PROPERTY_ID, VALUE) on b_iblock_element_property. Run OPTIMIZE TABLE b_iblock_element_property after mass operations.
How to configure three-level caching?
Managed component cache. Set TTL individually for each component. Catalog — 3600 sec, news feed — 300 sec, banners — 86400. The same TTL everywhere guarantees either outdated data or useless cache.
Composite cache. The bitrix:composite technology lets Nginx serve ready HTML from a file; PHP is not executed. Dynamic zones (cart, authorization) are loaded via AJAX request through CBitrixComponent::setFrameMode(true). TTFB drops below 50 ms. However, not all components are compatible; $APPLICATION->ShowPanel() and direct output via echo break the composite. We check every page through the panel 'Performance → Composite Site'. According to Bitrix official documentation on composite cache, this is the most effective caching method for high‑load projects.
Comparison: composite cache is 10–20 times faster than managed cache in time to first byte.
Memcached / Redis. Transfer cache from the file system: sessions go to Redis (session.save_handler = redis) — 10–50 times faster than files, plus cluster support. Component cache goes to Memcached via .settings.php: 'cache' => ['type' => 'memcache']. Also enable ORM query cache so identical GetList() calls don't hit MySQL on every request.
What is the fastest way to optimize Bitrix database?
Default MySQL settings are insufficient. Indexes — composite for faceted search, covering for frequent queries. MySQL responds from the index without accessing the data. Partial indexes (MariaDB) for filtering by ACTIVE = 'Y'. Audit unused indexes — each slows down INSERT/UPDATE.
Partitioning. For tables with millions of rows: b_stat_session, b_search_content_stem, and highload-blocks with history. Partition by date — a query for 'orders in a month' does not scan three years of data. Partitioning also solves the problem of concurrent queries during exchange with 1С via CommerceML.
Real case: a catalog of 200,000 products, 50 properties. Filtering by 10 properties took 12 seconds. After creating composite indexes on (IBLOCK_ID, IBLOCK_PROPERTY_ID, VALUE) and partitioning b_iblock_element_property by IBLOCK_ID, execution time dropped to 0.3 seconds. MySQL load decreased by 40 times.
Cleanup. Over a year or two, any database accumulates: outdated search index, expired records in b_cache_tag, history in b_iblock_element_prop_s*, logs in b_event_log taking gigabytes. We set up regular cleanup via agents.
Frontend and CDN
Images account for 60–80% of page weight. Convert to WebP via CFile::ResizeImageGet() with BX_RESIZE_IMAGE_PROPORTIONAL + conversion. Use srcset + sizes — never load a 3000px image into a 400px block. Add loading="lazy" for everything below the fold. AVIF offers another 20–30% savings vs WebP.
CSS/JS optimization: use the built-in Bitrix module to merge and minify via 'Settings → CSS/JS Optimization'. Apply PurgeCSS / UnCSS — in a typical Bitrix project, 60–70% of CSS is unused. Use defer / async for non‑critical JS and inline critical CSS in <head> for instant FCP.
Fonts: add <link rel="preload" as="font" crossorigin> for the main font. Set font-display: swap — text visible immediately. Subset via pyftsubset — keep only Cyrillic + Latin, file size reduces by 3–5 times.
CDN: Cloudflare, BunnyCDN, AWS CloudFront, or Russian providers (Selectel CDN, VK Cloud CDN). Serve static assets (CSS, JS, images, fonts) via CDN with Cache-Control: public, max-age=31536000, immutable for files with a hash. Use on‑the‑fly image optimization (imgproxy, Cloudflare Polish) without load on origin.
Why is load testing necessary?
Not synthetic benchmarks, but real scenarios: k6 / wrk to simulate routes — catalog → filtering → product card → cart → checkout. Measure RPS, response time (p50, p95, p99), error rate. Use Xdebug (callgrind) or Blackfire for PHP profiling to find bottlenecks. The test result gives an objective picture of where it actually slows down, not where it 'seems'. After optimization, run again to record improvements.
Results
| Metric |
Before |
After |
| TTFB |
800–2000 ms |
50–200 ms |
| Full load |
4–8 sec |
1.5–2.5 sec |
| PageSpeed (mobile) |
30–50 |
80–95 |
| Concurrent users |
50–100 |
500–2000+ |
What is included in the work?
-
Current performance audit — analysis of slow queries, PHP profiling, check of caching, CDN, server settings.
-
Server configuration — Nginx, PHP-FPM, MySQL, Redis/Memcached, OPcache.
-
Caching optimization — managed cache, composite site, TTL configuration, tagged caching.
-
Database work — index creation, partitioning, cleanup, EAV table reorganization.
-
Frontend — images (WebP/AVIF), CSS/JS (minification, deferred), fonts (preload, subsetting).
-
CDN — connection, caching rule setup.
-
Load testing — real user scenarios, metric report.
-
Documentation — description of all changes, recommendations for further maintenance.
-
Guarantee — support for 1 month after delivery, ensuring all optimizations are stable.
Monitoring
Without monitoring, everything degrades in six months. A new module, uncleared logs, a template change — and speed returns to original. Use web-vitals API for Real User Monitoring from actual visitors. Set up synthetic monitoring with Pingdom or UptimeRobot for regular checks from different locations. Configure alerts — TTFB > 500 ms or LCP > 3 sec triggers notification.
Timelines and cost
| Type of work |
Timeline |
| Basic optimization (cache, images, minification) |
2–3 days |
| Database optimization (indexes, slow queries, configuration) |
3–5 days |
| Server infrastructure (Nginx, PHP-FPM, Redis) |
2–3 days |
| Comprehensive (server + database + frontend + CDN) |
1–3 weeks |
| Load testing and profiling |
2–3 days |
| Cluster architecture (balancing, replication) |
1–2 weeks |
Cost is calculated individually after the audit. Get a consultation for your project — we will evaluate the current state and propose an acceleration plan with specific timelines and budget. We are a team with 12+ years of experience in Bitrix, having completed over 300 site speed optimization projects. Contact us to start the performance audit today.