{"id":473576,"date":"2025-09-02T16:58:37","date_gmt":"2025-09-02T16:58:37","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=473576"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=473576","title":{"rendered":"<span>\u0412\u044b\u0436\u0438\u043c\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0437 Postgres \u043d\u0430 RTABench Q0<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0440\u0435\u043c\u044f \u043e\u0442\u00a0\u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u00a0Postgres \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435\u00a0\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438. \u041f\u0440\u0438\u00a0\u043f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c, \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u00a0\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u00a0TPC\u2011H \u0438\u043b\u0438\u00a0ClickBench. \u0427\u0442\u043e\u00a0\u0436, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c 100\u00a0\u043c\u043b\u043d \u0441\u0442\u0440\u043e\u043a \u043d\u0430\u00a0\u0434\u0438\u0441\u043a\u0435 \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438\u00a0\u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u043d\u0430\u0441 \u0432\u00a0\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0421\u0423\u0411\u0414. \u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u0441\u043e\u043a\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b, \u0438\u043c \u043f\u043e\u00a0\u0444\u0430\u043a\u0442\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u00a0\u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0444\u043e\u043a\u0443\u0441 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u043f\u043e\u0440\u044f\u0434\u043e\u043a JOIN\u043e\u0432, \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u0412\u00a0\u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Postgres, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0435\u0441\u044c\u043c\u0430 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e&#8230;<\/p>\n<p>\u042f \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043c\u043e\u0436\u043d\u043e\u00a0\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 Postgres, \u0435\u0441\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a <a href=\"https:\/\/rtabench.com\/\" rel=\"noopener noreferrer nofollow\">RTABench<\/a>\u00a0\u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0432\u0435\u0436\u0438\u0439, \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u043a &#8216;\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u0439 \u043a\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439&#8217;. \u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0435\u0433\u043e \u043f\u043b\u044e\u0441\u00a0\u2014 \u0432\u00a0\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0434 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0438\u043f\u043e\u043c <code>JSONB<\/code>. \u0414\u0430\u00a0\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b Postgres \u043d\u0430\u00a0RTABench \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435\u00a0\u043e\u0447\u0435\u043d\u044c. \u0412\u00a0\u043e\u0431\u0449\u0435\u043c, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e\u00a0\u0432\u0441\u0435\u043c \u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c (\u0431\u043b\u0430\u0433\u043e \u0438\u0445 \u043d\u0435\u00a0\u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e) \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e\u00a0\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0443\u0436\u0435 \u043d\u0430\u00a0\u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0442\u043e\u0438\u043b\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0435\u0442\u0430\u043f \u0443\u00a0\u043c\u0435\u043d\u044f \u043d\u0435\u00a0\u0441\u0430\u043c\u044b\u0439 \u0441\u0432\u0435\u0436\u0438\u0439\u00a0\u2014 Macbook Pro 2019, \u0435\u0449\u0451 \u043d\u0430\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Intel, \u0436\u0434\u0430\u0442\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0445 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0446\u0438\u0444\u0440 \u043d\u0435\u00a0\u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435, \u0430\u00a0\u043d\u0435\u00a0\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438. \u0418 \u0434\u043b\u044f\u00a0\u0442\u0430\u043a\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u043e\u0435\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u043e\u00a0\u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 Postgres \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/postgresql.conf\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u043d\u043e: <a href=\"https:\/\/github.com\/timescale\/rtabench\/blob\/main\/postgres\/queries\/0000_terminal_hourly_stats.sql\" rel=\"noopener noreferrer nofollow\">\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u043d\u0430\u0434 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, BUFFERS ON, TIMING ON, SETTINGS ON) WITH hourly_stats AS (   SELECT      date_trunc('hour', event_created) as hour,     event_payload-&gt;&gt;'terminal' AS terminal,     count(*) AS event_count   FROM order_events   WHERE      event_created &gt;= '2024-01-01' AND     event_created &lt; '2024-02-01'     AND event_type IN ('Created', 'Departed', 'Delivered')   GROUP BY hour, terminal ) SELECT    hour,   terminal,   event_count,   AVG(event_count) OVER (     PARTITION BY terminal     ORDER BY hour     ROWS BETWEEN 3 PRECEDING AND CURRENT ROW   ) AS moving_avg_events FROM hourly_stats WHERE terminal IN ('Berlin', 'Hamburg', 'Munich') ORDER BY terminal, hour;<\/code><\/pre>\n<h2>\u0424\u0430\u0437\u0430 0 (&#8216;\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435&#8217;)<\/h2>\n<p>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u0434 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (EXPLAIN \u043f\u043e\u0447\u0438\u0449\u0435\u043d):<\/p>\n<pre><code>WindowAgg  (actual time=21053.119 rows=2232)   Window: w1 AS (PARTITION BY    order_events.event_payload -&gt;&gt; 'terminal'    ORDER BY date_trunc('hour', order_events.event_created))   Buffers: shared read=3182778   -&gt; Sort  (actual time=21052.476 rows=2232)      Sort Key:       order_events.event_payload -&gt;&gt; 'terminal',       date_trunc('hour', order_events.event_created)       Sort Method: quicksort  Memory: 184kB    -&gt; GroupAggregate  (actual time=21051.875 rows=2232)        Group Key:         date_trunc('hour', order_events.event_created),         order_events.event_payload -&gt;&gt; 'terminal'      -&gt; Sort (actual time=21037.609..21042.766 rows=204053)          Sort Key:           date_trunc('hour', order_events.event_created),           order_events.event_payload -&gt;&gt; 'terminal'          Sort Method: quicksort  Memory: 12521kB        -&gt; Bitmap Heap Scan on order_events (actual time=20999.978 rows=204053)           Recheck Cond: event_type = ANY ('{Created,Departed,Delivered}')           Filter:            event_created &gt;= '2024-01-01 00:00:00+00' AND            event_created &lt; '2024-02-01 00:00:00+00' AND            event_payload -&gt;&gt; 'terminal') = ANY ('{Berlin,Hamburg,Munich}')           Rows Removed by Filter: 57210049           Heap Blocks: exact=3133832           Buffers: shared read=3182778         -&gt; Bitmap Index Scan (actual time=1683.357 rows=57414102)            Index Cond: event_type = ANY ('{Created,Departed,Delivered}')            Index Searches: 1            Buffers: shared read=48946 Execution Time: 21060.564 ms<\/code><\/pre>\n<p>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 21\u00a0\u0441\u0435\u043a\u0443\u043d\u0434\u0430? \u0427\u0442\u043e\u2011\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u0430 \u0437\u0434\u0435\u0441\u044c \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u0443\u00a0\u043d\u0430\u0441 \u043f\u043e\u2011\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439, \u043c\u0430\u043b\u043e\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441. \u041f\u043e\u00a0\u044d\u043a\u0441\u043f\u043b\u0435\u0439\u043d\u0443 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e\u00a0\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0437\u0434\u0435\u0441\u044c\u00a0\u2014 \u044d\u0442\u043e \u0441\u0431\u043e\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 (tid) \u0441\u0442\u0440\u043e\u043a\u2011\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432\u00a0\u2014 1.6c, \u0430\u00a0\u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e\u00a0\u044d\u0442\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f 98% \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u00a0\u2014 19\u0441.<\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u0441\u0430\u0434\u0430 \u0437\u0434\u0435\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0430\u0441\u044c \u0441\u0440\u0430\u0437\u0443. \u042f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043f\u043e\u0434 shared_buffers 8GB, \u043e\u0434\u043d\u0430\u043a\u043e \u0421\u0423\u0411\u0414 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0434 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u043b\u044e \u044d\u0442\u0438\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432. \u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0442\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0438 \u043c\u043d\u043e\u0433\u043e\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0430\u044f, \u043d\u043e \u0432 \u0431\u0430\u0437\u0435 \u043b\u0435\u0436\u0438\u0442 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 <code>NBuffers \/ MaxBackends<\/code>. \u0412 \u0438\u0442\u043e\u0433\u0435, \u0441 \u043c\u043e\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 Postgres \u0432\u044b\u0434\u0435\u043b\u0438\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 2.4 GB \u043d\u0430 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0439 \u0431\u0430\u0437\u044b \u0432 \u043e\u0434\u043d\u0443 \u0448\u0438\u0440\u043e\u043a\u0443\u044e \u0438 \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0443\u0436\u0435 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 Postgres  \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u0434\u0435\u0435\u0439.<\/p>\n<p>\u0425\u043e\u0442\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u0440\u0438\u0432\u043e, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e &#8212; \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e69\/649\/d5c\/e69649d5cf8e6b0aaaec16fad718ebaa.png\" alt=\"\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 execution time \u0437\u0430\u043f\u0440\u043e\u0441\u0430 Q0 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432\" title=\"\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 execution time \u0437\u0430\u043f\u0440\u043e\u0441\u0430 Q0 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432\" width=\"678\" height=\"420\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/e69\/649\/d5c\/e69649d5cf8e6b0aaaec16fad718ebaa.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e69\/649\/d5c\/e69649d5cf8e6b0aaaec16fad718ebaa.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 execution time \u0437\u0430\u043f\u0440\u043e\u0441\u0430 Q0 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0435\u0441\u044c\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b &#8212; \u044d\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0441 \u0434\u0438\u0441\u043a\u0430 \u0438 \u0434\u0435\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u0443\u043f\u043b\u0430, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043e\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u0436\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. \u041d\u043e \u043e\u0442\u043a\u0443\u0434\u0430 \u044d\u0442\u043e\u0442 \u0441\u043a\u0430\u0447\u043e\u043a \u043c\u0435\u0436\u0434\u0443 6 \u0438 7 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438? \u0417\u0430\u0433\u043b\u044f\u043d\u0443\u0432 \u0432 <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-workers.md\" rel=\"noopener noreferrer nofollow\">EXPLAIN&#8217;\u044b<\/a> \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043d\u044f\u0442\u044c &#8212; \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430 \u043c\u0430\u043b\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <code>BitmapScan<\/code>, \u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0436\u0435 \u0434\u043e\u043c\u0438\u043d\u0438\u0440\u0443\u0435\u0442 <code>SeqScan<\/code>.<\/p>\n<p>\u0422\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c SeqScan \u0441\u0442\u043e\u0438\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0430 \u043c\u0430\u043b\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f BitmapScan \u0438 SeqScan, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u043e\u0434 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0432 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430\u0445):<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b7a\/955\/735\/b7a95573590bba3065450771d0890d34.png\" width=\"600\" height=\"371\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b7a\/955\/735\/b7a95573590bba3065450771d0890d34.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b7a\/955\/735\/b7a95573590bba3065450771d0890d34.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0438 \u044d\u043a\u0441\u043f\u043b\u0435\u0439\u043d\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-workers-noseqscan-O3.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-workers-nobitmapscan-O3.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0414\u0435\u043b\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u043c\u0430\u043b\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 BitmapScan \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u043a\u043e\u0441\u0442 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a SeqScan, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u0441 execution time. \u0414\u0435\u043b\u043e \u0442\u0443\u0442 \u0432\u0438\u0434\u0438\u043c\u043e \u0432 \u0442\u043e\u043d\u043a\u043e\u043c \u0431\u0430\u043b\u0430\u043d\u0441\u0435: \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0440\u043e\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \/ \u043d\u043e \u0447\u0430\u0449\u0435 \u0445\u043e\u0434\u0438\u043b \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0422\u043e\u0447\u043d\u0435\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 explain \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u044d\u0441\u0442\u0438\u043c\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a, \u043f\u043e\u0434\u043d\u044f\u0442\u043e\u0435 \u0441 \u0434\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0435\u0434 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u043e\u0446\u0435\u043d\u043a\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0444\u0435\u0442\u0447\u0435\u043d\u044b\u0445 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u0434\u043e\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0440\u0430\u0437\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0430\u0442\u0441\u044f \u0432 shared_buffers. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043a\u043e\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0443\u044e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c SeqScan \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 BitmapScan, \u0447\u0442\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u043d\u0430 SeqScan. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0434\u043b\u044f SeqScan \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b cost \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0432 SeqScan \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043a\u0430 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h2>\u0424\u0430\u0437\u0430 1 (&#8216; \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f&#8217;)<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u0441\u0442 Postgres \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441. \u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0431\u043e\u0440 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c:<\/p>\n<pre><code class=\"sql\">CREATE INDEX idx_1 ON order_events (event_created);<\/code><\/pre>\n<p>\u0421 \u0442\u0430\u043a\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 IndexScan \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432) \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043e 6.5\u0441. \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0440\u043e\u0433\u0430\u043b \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b 3 \u043c\u043b\u043d. \u0440\u0430\u0437 (shared read=3182778), \u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043f\u0440\u0438 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435\u00a0\u2014 \u0443\u0436\u0435 14\u00a0\u043c\u043b\u043d. (shared hit=14317527). \u0425\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0432\u044b\u0442\u0435\u0441\u043d\u044f\u043b\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0435\u043c\u0443 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438\u0441\u044c \u0432 shared buffers, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044e.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043b\u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u044b, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <em>cost model<\/em>:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7ee\/737\/389\/7ee737389fa37e9f6e711338bdbec407.png\" alt=\"\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Parallel Index Scan \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435)\" title=\"\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Parallel Index Scan \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435)\" width=\"600\" height=\"371\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/7ee\/737\/389\/7ee737389fa37e9f6e711338bdbec407.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7ee\/737\/389\/7ee737389fa37e9f6e711338bdbec407.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Parallel Index Scan \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435)<\/figcaption><\/div>\n<\/figure>\n<p>\u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-optphase-1.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0414\u0430, \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435. \u042d\u0444\u0444\u0435\u043a\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0434\u043e 24, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0418 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437\u00a0\u043c\u0438\u043d\u0443\u0441\u043e\u0432 Postgres\u00a0\u2014 \u0445\u043e\u0442\u044f \u043c\u044b \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0433\u0443\u043a\u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>order_events<\/code> \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0441\u0442\u0430\u043b \u0432 \u043d\u0430\u043c\u0435\u0440\u0442\u0432\u043e \u0437\u0430\u0448\u0438\u0442\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (10 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b), \u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0435\u0433\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"sql\">ALTER TABLE order_events SET (parallel_workers = 32);<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u043d\u0435\u044f\u0432\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u044d\u0441\u0442\u0438\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 JOIN, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u043d\u0430 <em>outer<\/em>-\u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u041b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0433\u0434\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0430\u044f. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0451 jointree \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437-\u0437\u0430 \u043e\u0434\u043d\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b!<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0444\u0430\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u00a0\u2014 cost\u2011\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f Index Scan \u0432\u0435\u0441\u044c\u043c\u0430 \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u043d\u0430: \u043f\u0440\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u043e\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0438 8, \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0434\u0430\u0436\u0435 \u0434\u0432\u0443\u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f. \u041e\u0442\u0441\u044e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u044b: 1) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u0442\u0435\u0441\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u0438\u043c\u0438\u0442\u044b \u043f\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c \u0438 2) \u041d\u043e\u0434\u044b \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0431\u043e\u043b\u0435\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (\u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u0438 \u0442\u0430\u043a\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 SeqScan), \u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0445\u0443\u0434\u0448\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 &#8212; \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0435\u043b \u043c\u0435\u0447\u0442\u0430\u043d\u0438\u0439. \u041f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0438\u043c\u0441\u044f \u043a \u043d\u043e\u0434\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435:<\/p>\n<pre><code class=\"sql\">Index Scan (actual time=6555.122 rows=204053)   Index Cond: event_created &gt;= '2024-01-01 00:00:00+00' AND     event_created &lt; '2024-02-01 00:00:00+00'   Filter: event_type = ANY ('{Created,Departed,Delivered}' AND     event_payload -&gt;&gt; 'terminal' = ANY ('{Berlin,Hamburg,Munich}')   Rows Removed by Filter: 14099758   Index Searches: 1   Buffers: shared hit=14317527<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043f\u043e\u0442\u0440\u043e\u0433\u0430\u043d\u043e, \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u043e\u0442\u0444\u0438\u043b\u044c\u0440\u043e\u0432\u0430\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0434\u0438\u0441\u043a\u0430.<\/p>\n<h2>\u0424\u0430\u0437\u0430 2 (&#8216;\u0423\u0441\u0438\u043b\u0435\u043d\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f&#8217;)<\/h2>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0435\u0441\u043d\u044f\u0442\u044c\u0441\u044f \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0439 &#8216;index adviser&#8217;, \u0434\u0430\u044e\u0449\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 (\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c) \u043f\u0440\u043e\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b. \u042d\u0442\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u044f \u0432\u0441\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e\u0434 \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u041e\u0442\u043a\u0438\u0434\u044b\u0432\u0430\u044f GIN Index, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u043b\u0435 event_payload \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e, \u0438\u043c\u0435\u0435\u043c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<pre><code class=\"sql\">CREATE INDEX idx_2 ON order_events (event_created, event_type)   INCLUDE (event_payload); CREATE INDEX idx_3 ON order_events (event_created, event_type);<\/code><\/pre>\n<p>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 idx_2 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u043e\u043e\u0431\u0449\u0435, \u0430 idx_3 \u043c\u043e\u0436\u0435\u0442 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043d\u0443\u0442\u044c \u043a\u0430\u043a IndexScan, \u0442\u0430\u043a \u0438 BitmapScan. \u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u044d\u043a\u0441\u043f\u043b\u0435\u0439\u043d\u043e\u0432 \u0441 \u044d\u0442\u0438\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-index-variety.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 idx_1 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 idx_2 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u043d\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 IndexOnlyScan. \u0421\u0443\u0434\u044f \u043f\u043e \u0432\u0441\u0435\u043c\u0443, \u0434\u0435\u043b\u043e \u0437\u0434\u0435\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0446\u0435\u043d\u043a\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0441 \u0438\u043c\u0435\u0435\u0442 \u0448\u0438\u0440\u0438\u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u0410 jsonb \u043f\u043e\u043b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u043e \u0440\u0430\u0437\u043c\u0435\u0440 idx_2.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441 idx_3 \u043f\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u044c \/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f BitmapScan. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043a \u043d\u043e\u0434\u0430\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u043e\u0447\u0435\u043c\u0443:<\/p>\n<pre><code class=\"sql\">Bitmap Heap Scan (actual time=1286.430 rows=204053   Rows Removed by Filter: 4292642   Heap Blocks: exact=269237   Buffers: shared hit=313925   Bitmap Index Scan (actual time=625.170 rows=4496695)     Index Searches: 1     Buffers: shared hit=44688  Index Only Scan (actual time=1586.097 rows=204053)   Rows Removed by Filter: 4292642   Heap Fetches: 0   Index Searches: 1   Buffers: shared hit=2558314  Index Scan (actual time=2847.517 rows=204053)   Rows Removed by Filter: 4292642   Index Searches: 1   Buffers: shared hit=4509185<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0442\u0440\u043e\u0435 \u0432\u043e\u0437\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a. \u041e\u0434\u043d\u0430\u043a\u043e, IndexOnlyScan \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0443 Index Scan \u0437\u0430 \u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0442\u0440\u043e\u0433\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0440\u0435\u0436\u0435 (2.6 \u043c\u043b\u043d.  V\/S 4.5 \u043c\u043b\u043d.); BitmapScan \u0436\u0435 \u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0435\u0449\u0451\u0440\u0435\u0436\u0435 (300\u00a0\u0442\u044b\u0441. \u0440\u0430\u0437)\u00a0\u2014 \u043f\u0440\u043e\u0439\u0434\u044f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0438 \u0441\u043e\u0431\u0440\u0430\u0432 tid \u0441\u0442\u0440\u043e\u043a-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432, \u043e\u043d \u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0435\u0442 \u0442\u043e\u0447\u0435\u0447\u043d\u043e \u0432 \u0445\u0438\u043f \u0442\u0440\u043e\u0433\u0430\u044f \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0432\u0438\u0434\u043e\u0432 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f96\/18a\/b1a\/f9618ab1a2699a786df30cd33511e41e.png\" alt=\"\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432\" title=\"\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432\" width=\"687\" height=\"425\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/f96\/18a\/b1a\/f9618ab1a2699a786df30cd33511e41e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f96\/18a\/b1a\/f9618ab1a2699a786df30cd33511e41e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 BitmapScan \u043d\u0435\u0442 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0440\u043a\u0435\u0440\u044b. \u0418\u043c\u0435\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u0438 \u043d\u0435\u0432\u044b\u0441\u043e\u043a\u0443\u044e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 BitmapScan.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 cost-\u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u044f\u0442\u044c \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u044d\u0444\u0444\u0435\u043a\u0442\u0443 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430. \u0418 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0442\u043e\u0438\u0442 \u0447\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c. \u0422\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043e, \u0447\u0442\u043e \u043d\u0430 \u0447\u0438\u0441\u043b\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 8+ \u043e\u043f\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u043d\u0430 SeqScan, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 ~1c \u0434\u043e ~21c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u00a0SeqScan \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u0430\u0436\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u0439\u0434\u0435\u043c \u0436\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u043c \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c.<\/p>\n<h3>\u0424\u0430\u0437\u0430 3 (&#8216;\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f&#8217;)<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u00a0&#8216;Disk Access Tuner&#8217;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0432\u044b\u0441\u043e\u043a\u043e \u0438 \u043d\u0438\u0437\u043a\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043d\u0430\u00a0\u0442\u0430\u0431\u043b\u0438\u0446\u0435\u00a0\u2014 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u043e\u0432\u043e\u0434 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043f\u0440\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441:<\/p>\n<pre><code class=\"sql\">CREATE INDEX idx_5 ON order_events (event_created, event_type) INCLUDE (event_payload) WHERE   event_created &gt;= '2024-01-01' and event_created &lt; '2024-02-01' AND   event_type IN ('Created', 'Departed', 'Delivered') AND   (event_payload -&gt;&gt; 'terminal'::text) = ANY ('{Berlin,Hamburg,Munich}'::text[]);<\/code><\/pre>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c, \u0438 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u044d\u0442\u043e\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u0447\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u0431\u0435\u0437 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432) \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 54 \u043c\u0441 (\u0441\u043c. \u044d\u043a\u0441\u043f\u043b\u0435\u0439\u043d\u044b <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-optphase-3.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<p>\u0418\u043c\u0435\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430, \u0447\u0442\u043e \u044d\u0441\u0442\u0438\u043c\u0430\u0446\u0438\u044f \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<pre><code class=\"sql\">Index Only Scan (cost=0.42..4998.13 rows=70210)                 (actual time=34.718 rows=204053.00 loops=1)     Heap Fetches: 0     Index Searches: 1     Buffers: shared hit=110862<\/code><\/pre>\n<p>\u0423 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u0430 \u043e\u043d \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043e\u0448\u0438\u0431\u0430\u0435\u0442\u0441\u044f! \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0440\u043e\u043b\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u0432\u044b\u0448\u0435 \u0431\u044b\u043b\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u0434\u0436\u043e\u0439\u043d\u043e\u0432, \u0442\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u044d\u0441\u0442\u0438\u043c\u0430\u0446\u0438\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0437\u0443 \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u043d\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0443\u0442\u043e\u0447\u043d\u044f\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u043e \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c?<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0436\u0435 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438 \u0437\u0434\u0435\u0441\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430 \u0441\u0447\u0451\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u0412\u0432\u0438\u0434\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0434\u043e\u043b\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 (\u043d\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439) \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 actual time \u0438 estimated cost \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u043e\u0434\u044b \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aab\/b38\/49c\/aabb3849cf7963848cf3b119730dca59.png\" alt=\"\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Index Only Scan \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432\" title=\"\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Index Only Scan \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432\" width=\"600\" height=\"371\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/aab\/b38\/49c\/aabb3849cf7963848cf3b119730dca59.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aab\/b38\/49c\/aabb3849cf7963848cf3b119730dca59.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Index Only Scan \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0440\u0430\u0437 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f IndexOnlyScan \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0451\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u0445. \u041d\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u0436\u0435 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 cost \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b? \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u0430 \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u043d\u0430 \u0432 \u0441\u0438\u043b\u0443 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u043e\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f. \u0410 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043c \u043d\u0435\u044f\u0432\u043d\u043e \u0437\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u044f\u0434\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0439 \u0431\u044d\u043a\u0435\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u0440\u0435\u0441\u0443\u0440\u0441? \u041a\u0430\u043a \u0431\u044b \u0442\u043e \u043d\u0438 \u0431\u044b\u043b\u043e, \u043b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u043c\u0435\u0442\u044c \u044f\u0432\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u0437\u043d\u0430\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u041a\u0430\u043a\u0438\u0435 \u0443\u0440\u043e\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430?<\/p>\n<ol>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u044b \u043e\u0449\u0443\u0442\u0438\u043c\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0421\u0442\u043e\u0438\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0441\u0442-\u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u0434 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u0434\u043e\u043b\u044e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043b\u0430\u043d\u043e\u0432 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 IndexScan.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u043a\u043e\u0441\u0442-\u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u0432 Postgres \u0435\u0449\u0451 \u043d\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0436\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438 \u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0432\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 SeqScan.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432  Postgres, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0435\u043c\u0443 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<p>THE END<br \/><em>\u0418\u0441\u043f\u0430\u043d\u0438\u044f, \u041c\u0430\u0434\u0440\u0438\u0434, 26 \u0438\u044e\u043b\u044f 2025 \u0433\u043e\u0434\u0430.<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/931410\/\"> https:\/\/habr.com\/ru\/articles\/931410\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0440\u0435\u043c\u044f \u043e\u0442\u00a0\u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u00a0Postgres \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435\u00a0\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438. \u041f\u0440\u0438\u00a0\u043f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c, \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u00a0\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u00a0TPC\u2011H \u0438\u043b\u0438\u00a0ClickBench. \u0427\u0442\u043e\u00a0\u0436, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c 100\u00a0\u043c\u043b\u043d \u0441\u0442\u0440\u043e\u043a \u043d\u0430\u00a0\u0434\u0438\u0441\u043a\u0435 \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438\u00a0\u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u043d\u0430\u0441 \u0432\u00a0\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0421\u0423\u0411\u0414. \u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u0441\u043e\u043a\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b, \u0438\u043c \u043f\u043e\u00a0\u0444\u0430\u043a\u0442\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u00a0\u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0444\u043e\u043a\u0443\u0441 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u043f\u043e\u0440\u044f\u0434\u043e\u043a JOIN\u043e\u0432, \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u0412\u00a0\u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Postgres, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0435\u0441\u044c\u043c\u0430 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e&#8230;<\/p>\n<p>\u042f \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043c\u043e\u0436\u043d\u043e\u00a0\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 Postgres, \u0435\u0441\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a <a href=\"https:\/\/rtabench.com\/\" rel=\"noopener noreferrer nofollow\">RTABench<\/a>\u00a0\u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0432\u0435\u0436\u0438\u0439, \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u043a &#8216;\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u0439 \u043a\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439&#8217;. \u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0435\u0433\u043e \u043f\u043b\u044e\u0441\u00a0\u2014 \u0432\u00a0\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0434 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0438\u043f\u043e\u043c <code>JSONB<\/code>. \u0414\u0430\u00a0\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b Postgres \u043d\u0430\u00a0RTABench \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435\u00a0\u043e\u0447\u0435\u043d\u044c. \u0412\u00a0\u043e\u0431\u0449\u0435\u043c, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e\u00a0\u0432\u0441\u0435\u043c \u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c (\u0431\u043b\u0430\u0433\u043e \u0438\u0445 \u043d\u0435\u00a0\u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e) \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e\u00a0\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0443\u0436\u0435 \u043d\u0430\u00a0\u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0442\u043e\u0438\u043b\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0435\u0442\u0430\u043f \u0443\u00a0\u043c\u0435\u043d\u044f \u043d\u0435\u00a0\u0441\u0430\u043c\u044b\u0439 \u0441\u0432\u0435\u0436\u0438\u0439\u00a0\u2014 Macbook Pro 2019, \u0435\u0449\u0451 \u043d\u0430\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Intel, \u0436\u0434\u0430\u0442\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0445 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0446\u0438\u0444\u0440 \u043d\u0435\u00a0\u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435, \u0430\u00a0\u043d\u0435\u00a0\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438. \u0418 \u0434\u043b\u044f\u00a0\u0442\u0430\u043a\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u043e\u0435\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u043e\u00a0\u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 Postgres \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/postgresql.conf\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u043d\u043e: <a href=\"https:\/\/github.com\/timescale\/rtabench\/blob\/main\/postgres\/queries\/0000_terminal_hourly_stats.sql\" rel=\"noopener noreferrer nofollow\">\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u043d\u0430\u0434 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, BUFFERS ON, TIMING ON, SETTINGS ON) WITH hourly_stats AS (   SELECT      date_trunc('hour', event_created) as hour,     event_payload-&gt;&gt;'terminal' AS terminal,     count(*) AS event_count   FROM order_events   WHERE      event_created &gt;= '2024-01-01' AND     event_created &lt; '2024-02-01'     AND event_type IN ('Created', 'Departed', 'Delivered')   GROUP BY hour, terminal ) SELECT    hour,   terminal,   event_count,   AVG(event_count) OVER (     PARTITION BY terminal     ORDER BY hour     ROWS BETWEEN 3 PRECEDING AND CURRENT ROW   ) AS moving_avg_events FROM hourly_stats WHERE terminal IN ('Berlin', 'Hamburg', 'Munich') ORDER BY terminal, hour;<\/code><\/pre>\n<h2>\u0424\u0430\u0437\u0430 0 (&#8216;\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435&#8217;)<\/h2>\n<p>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u0434 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (EXPLAIN \u043f\u043e\u0447\u0438\u0449\u0435\u043d):<\/p>\n<pre><code>WindowAgg  (actual time=21053.119 rows=2232)   Window: w1 AS (PARTITION BY    order_events.event_payload -&gt;&gt; 'terminal'    ORDER BY date_trunc('hour', order_events.event_created))   Buffers: shared read=3182778   -&gt; Sort  (actual time=21052.476 rows=2232)      Sort Key:       order_events.event_payload -&gt;&gt; 'terminal',       date_trunc('hour', order_events.event_created)       Sort Method: quicksort  Memory: 184kB    -&gt; GroupAggregate  (actual time=21051.875 rows=2232)        Group Key:         date_trunc('hour', order_events.event_created),         order_events.event_payload -&gt;&gt; 'terminal'      -&gt; Sort (actual time=21037.609..21042.766 rows=204053)          Sort Key:           date_trunc('hour', order_events.event_created),           order_events.event_payload -&gt;&gt; 'terminal'          Sort Method: quicksort  Memory: 12521kB        -&gt; Bitmap Heap Scan on order_events (actual time=20999.978 rows=204053)           Recheck Cond: event_type = ANY ('{Created,Departed,Delivered}')           Filter:            event_created &gt;= '2024-01-01 00:00:00+00' AND            event_created &lt; '2024-02-01 00:00:00+00' AND            event_payload -&gt;&gt; 'terminal') = ANY ('{Berlin,Hamburg,Munich}')           Rows Removed by Filter: 57210049           Heap Blocks: exact=3133832           Buffers: shared read=3182778         -&gt; Bitmap Index Scan (actual time=1683.357 rows=57414102)            Index Cond: event_type = ANY ('{Created,Departed,Delivered}')            Index Searches: 1            Buffers: shared read=48946 Execution Time: 21060.564 ms<\/code><\/pre>\n<p>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 21\u00a0\u0441\u0435\u043a\u0443\u043d\u0434\u0430? \u0427\u0442\u043e\u2011\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u0430 \u0437\u0434\u0435\u0441\u044c \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u0443\u00a0\u043d\u0430\u0441 \u043f\u043e\u2011\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439, \u043c\u0430\u043b\u043e\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441. \u041f\u043e\u00a0\u044d\u043a\u0441\u043f\u043b\u0435\u0439\u043d\u0443 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e\u00a0\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0437\u0434\u0435\u0441\u044c\u00a0\u2014 \u044d\u0442\u043e \u0441\u0431\u043e\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 (tid) \u0441\u0442\u0440\u043e\u043a\u2011\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432\u00a0\u2014 1.6c, \u0430\u00a0\u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e\u00a0\u044d\u0442\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f 98% \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u00a0\u2014 19\u0441.<\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u0441\u0430\u0434\u0430 \u0437\u0434\u0435\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0430\u0441\u044c \u0441\u0440\u0430\u0437\u0443. \u042f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043f\u043e\u0434 shared_buffers 8GB, \u043e\u0434\u043d\u0430\u043a\u043e \u0421\u0423\u0411\u0414 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0434 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u043b\u044e \u044d\u0442\u0438\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432. \u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0442\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0438 \u043c\u043d\u043e\u0433\u043e\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0430\u044f, \u043d\u043e \u0432 \u0431\u0430\u0437\u0435 \u043b\u0435\u0436\u0438\u0442 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 <code>NBuffers \/ MaxBackends<\/code>. \u0412 \u0438\u0442\u043e\u0433\u0435, \u0441 \u043c\u043e\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 Postgres \u0432\u044b\u0434\u0435\u043b\u0438\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 2.4 GB \u043d\u0430 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0439 \u0431\u0430\u0437\u044b \u0432 \u043e\u0434\u043d\u0443 \u0448\u0438\u0440\u043e\u043a\u0443\u044e \u0438 \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0443\u0436\u0435 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 Postgres  \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u0434\u0435\u0435\u0439.<\/p>\n<p>\u0425\u043e\u0442\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u0440\u0438\u0432\u043e, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e &#8212; \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 execution time \u0437\u0430\u043f\u0440\u043e\u0441\u0430 Q0 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0435\u0441\u044c\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b &#8212; \u044d\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0441 \u0434\u0438\u0441\u043a\u0430 \u0438 \u0434\u0435\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u0443\u043f\u043b\u0430, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043e\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u0436\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. \u041d\u043e \u043e\u0442\u043a\u0443\u0434\u0430 \u044d\u0442\u043e\u0442 \u0441\u043a\u0430\u0447\u043e\u043a \u043c\u0435\u0436\u0434\u0443 6 \u0438 7 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438? \u0417\u0430\u0433\u043b\u044f\u043d\u0443\u0432 \u0432 <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-workers.md\" rel=\"noopener noreferrer nofollow\">EXPLAIN&#8217;\u044b<\/a> \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043d\u044f\u0442\u044c &#8212; \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430 \u043c\u0430\u043b\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <code>BitmapScan<\/code>, \u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0436\u0435 \u0434\u043e\u043c\u0438\u043d\u0438\u0440\u0443\u0435\u0442 <code>SeqScan<\/code>.<\/p>\n<p>\u0422\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c SeqScan \u0441\u0442\u043e\u0438\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0430 \u043c\u0430\u043b\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f BitmapScan \u0438 SeqScan, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u043e\u0434 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0432 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430\u0445):<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0438 \u044d\u043a\u0441\u043f\u043b\u0435\u0439\u043d\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-workers-noseqscan-O3.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-workers-nobitmapscan-O3.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0414\u0435\u043b\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u043c\u0430\u043b\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 BitmapScan \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u043a\u043e\u0441\u0442 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a SeqScan, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u0441 execution time. \u0414\u0435\u043b\u043e \u0442\u0443\u0442 \u0432\u0438\u0434\u0438\u043c\u043e \u0432 \u0442\u043e\u043d\u043a\u043e\u043c \u0431\u0430\u043b\u0430\u043d\u0441\u0435: \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0440\u043e\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \/ \u043d\u043e \u0447\u0430\u0449\u0435 \u0445\u043e\u0434\u0438\u043b \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0422\u043e\u0447\u043d\u0435\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 explain \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u044d\u0441\u0442\u0438\u043c\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a, \u043f\u043e\u0434\u043d\u044f\u0442\u043e\u0435 \u0441 \u0434\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0435\u0434 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u043e\u0446\u0435\u043d\u043a\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0444\u0435\u0442\u0447\u0435\u043d\u044b\u0445 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u0434\u043e\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0440\u0430\u0437\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0430\u0442\u0441\u044f \u0432 shared_buffers. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043a\u043e\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0443\u044e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c SeqScan \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 BitmapScan, \u0447\u0442\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u043d\u0430 SeqScan. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0434\u043b\u044f SeqScan \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b cost \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0432 SeqScan \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043a\u0430 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h2>\u0424\u0430\u0437\u0430 1 (&#8216; \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f&#8217;)<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u0441\u0442 Postgres \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441. \u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0431\u043e\u0440 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c:<\/p>\n<pre><code class=\"sql\">CREATE INDEX idx_1 ON order_events (event_created);<\/code><\/pre>\n<p>\u0421 \u0442\u0430\u043a\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 IndexScan \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432) \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043e 6.5\u0441. \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0440\u043e\u0433\u0430\u043b \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b 3 \u043c\u043b\u043d. \u0440\u0430\u0437 (shared read=3182778), \u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043f\u0440\u0438 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435\u00a0\u2014 \u0443\u0436\u0435 14\u00a0\u043c\u043b\u043d. (shared hit=14317527). \u0425\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0432\u044b\u0442\u0435\u0441\u043d\u044f\u043b\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0435\u043c\u0443 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438\u0441\u044c \u0432 shared buffers, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044e.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043b\u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u044b, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <em>cost model<\/em>:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 Parallel Index Scan \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435)<\/figcaption><\/div>\n<\/figure>\n<p>\u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/danolivo\/conf\/blob\/main\/2025-RTABench\/query-0-optphase-1.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0414\u0430, \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435. \u042d\u0444\u0444\u0435\u043a\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0434\u043e 24, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0418 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437\u00a0\u043c\u0438\u043d\u0443\u0441\u043e\u0432 Postgres\u00a0\u2014 \u0445\u043e\u0442\u044f \u043c\u044b \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0433\u0443\u043a\u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>order_events<\/code> \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0441\u0442\u0430\u043b \u0432 \u043d\u0430\u043c\u0435\u0440\u0442\u0432\u043e \u0437\u0430\u0448\u0438\u0442\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (10 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b), \u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0435\u0433\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"sql\">ALTER TABLE order_events SET (parallel_workers = 32);<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u043d\u0435\u044f\u0432\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u044d\u0441\u0442\u0438\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 JOIN, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u043d\u0430 <em>outer<\/em>-\u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u041b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0433\u0434\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0430\u044f. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0451 jointree \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437-\u0437\u0430 \u043e\u0434\u043d\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b!<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0444\u0430\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u00a0\u2014 cost\u2011\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f Index Scan \u0432\u0435\u0441\u044c\u043c\u0430 \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u043d\u0430: \u043f\u0440\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u043e\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0438 8, \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0434\u0430\u0436\u0435 \u0434\u0432\u0443\u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f. \u041e\u0442\u0441\u044e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u044b: 1) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u0442\u0435\u0441\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u0438\u043c\u0438\u0442\u044b \u043f\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c \u0438 2) \u041d\u043e\u0434\u044b \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0431\u043e\u043b\u0435\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (\u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u0438 \u0442\u0430\u043a\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 SeqScan), \u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0445\u0443\u0434\u0448\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 &#8212; \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0435\u043b \u043c\u0435\u0447\u0442\u0430\u043d\u0438\u0439. \u041f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0438\u043c\u0441\u044f \u043a \u043d\u043e\u0434\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435:<\/p>\n<pre><code class=\"sql\">Index Scan (actual time=6555.122 rows=204053)   Index Cond: event_created &gt;= '2024-01-01 00:00:00+00' AND     event_created &lt; '2024-02-01 00:00:00+00'   Filter: event_type = ANY ('{Created,Departed,Delivered}' AND     event_payload -&gt;&gt; 'terminal' = ANY ('{Berlin,Hamburg,Munich}')   Rows Removed by Filter: 14099758   Index Searches: 1   Buffers: shared hit=14317527<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043f\u043e\u0442\u0440\u043e\u0433\u0430\u043d\u043e,<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-473576","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/473576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=473576"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/473576\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=473576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=473576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=473576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}