Skip to main content

Documentation Index

Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Compare Metrics Between Two Queries

To compare metrics between two queries, you must first obtain the query_id for both queries. You can then run the following query:
WITH
    initial_query_id = '9bc1b438-542e-450a-8284-0e3e2b3739c8' AS second,
    initial_query_id = '4ce13192-2849-48f9-b426-e04790c4f4aa' AS first
SELECT
    PE.1 AS metric,
    sumIf(PE.2, first) AS v1,
    sumIf(PE.2, second) AS v2,
    10 * log10(v2 / v1) AS dB,
    round(((v2 - v1) / if(v2 > v1, v2, v1)) * 100, 2) AS perc,
    bar(abs(perc), 0, 100, 33) AS bar
FROM clusterAllReplicas(default, system.query_log)
ARRAY JOIN ProfileEvents AS PE
WHERE (first OR second) AND (event_date >= (today() - 3)) AND (type = 2)
GROUP BY metric
HAVING (v1 != v2) AND (abs(perc) >= 0)
ORDER BY
    dB DESC,
    v2 DESC,
    metric ASC
FORMAT PrettyCompactMonoBlock
You will receive a table with metrics comparing the two queries:
┌─metric──────────────────────────────────────────────┬───────v1─┬───────v2─┬──────────────────dB─┬───perc─┬─bar───────────────────────────────┐
│ OSReadBytes                                         │        0528384 │                 inf │    100 │ █████████████████████████████████ │
│ OSIOWaitMicroseconds                                │        010000 │                 inf │    100 │ █████████████████████████████████ │
│ QueryProfilerRuns                                   │        01 │                 inf │    100 │ █████████████████████████████████ │
│ RealTimeMicroseconds                                │    5101998006112.83521165516512794.79 │ ███████████████████████████████▎  │
│ WaitPrefetchTaskMicroseconds                        │       2432211.27644629984224992.55 │ ██████████████████████████████▌   │
│ ConcurrencyControlSlotsAcquired                     │        55910.71882007306125691.53 │ ██████████████████████████████▏   │
│ DiskReadElapsedMicroseconds                         │      752854910.55697476489603891.2 │ ██████████████████████████████    │
│ CachedReadBufferReadFromCacheMicroseconds           │      767859710.49551562789274791.08 │ ██████████████████████████████    │
│ RemoteFSUnusedPrefetches                            │        2158.75061263391700186.67 │ ████████████████████████████▌     │
│ SelectedMarksTotal                                  │    875456340638.59901064126475386.19 │ ████████████████████████████▍     │
│ ThreadpoolReaderSubmitReadSynchronouslyMicroseconds │     1614103358.06406950577255484.38 │ ███████████████████████████▊      │
│ ThreadpoolReaderTaskMicroseconds                    │     1614103358.06406950577255484.38 │ ███████████████████████████▊      │
│ FilesystemCacheLockKeyMicroseconds                  │       17897.1894108526663980.9 │ ██████████████████████████▋       │
│ GlobalThreadPoolLockWaitMicroseconds                │       281356.83175737152786979.26 │ ██████████████████████████▏       │
│ LocalThreadPoolLockWaitMicroseconds                 │       17806.726410656136696578.75 │ █████████████████████████▉        │
│ RowsReadByPrewhereReaders                           │   1064964833286.56908659335307477.97 │ █████████████████████████▋        │
│ FileSegmentUseMicroseconds                          │        9406.47817481888637577.5 │ █████████████████████████▌        │
│ LocalThreadPoolShrinks                              │       17746.38782798352702277.03 │ █████████████████████████▍        │
│ LocalThreadPoolExpansions                           │       21785.69875307956561273.08 │ ████████████████████████          │
│ GlobalThreadPoolJobs                                │       22795.55204410468235272.15 │ ███████████████████████▊          │
│ SoftPageFaults                                      │      91030785.29227223174366370.44 │ ███████████████████████▏          │
│ LocalThreadPoolThreadCreationMicroseconds           │      1956515.2354637720567470.05 │ ███████████████████████           │
│ SelectedBytes                                       │  3415687113395795.21118864161558969.88 │ ███████████████████████           │
│ FileSegmentHolderCompleteMicroseconds               │        7235.166297960033360569.57 │ ██████████████████████▉           │
│ SystemTimeMicroseconds                              │    10124325255.06865168747407368.87 │ ██████████████████████▋           │
│ CompressedReadBufferBytes                           │  284080586419874.83172184993074667.13 │ ██████████████████████▏           │
│ CompressedReadBufferBlocks                          │       371014.36119649715647663.37 │ ████████████████████▉             │
│ OSCPUWaitMicroseconds                               │      1674344.14773258364927461.52 │ ████████████████████▎             │
│ SelectedRows                                        │   1064962621443.912066260130692459.38 │ ███████████████████▌              │
│ SelectedMarks                                       │       13323.912066260130692459.38 │ ███████████████████▌              │
│ RowsReadByMainReader                                │    853412096573.903516396636324459.29 │ ███████████████████▌              │
│ LocalThreadPoolJobs                                 │       721733.807136066975269658.38 │ ███████████████████▎              │
│ OSCPUVirtualTimeMicroseconds                        │    30914741493.799500957632875858.31 │ ███████████████████▏              │
│ ThreadpoolReaderSubmitLookupInCacheMicroseconds     │      59413243.481015401224875755.14 │ ██████████████████▏               │
│ FilesystemCacheGetOrSetMicroseconds                 │      2445353.4096395568249954.39 │ █████████████████▉                │
│ UserTimeMicroseconds                                │    20850420763.04928387128246250.45 │ ████████████████▋                 │
│ FileSegmentWaitReadBufferMicroseconds               │      69813362.819510355163657347.75 │ ███████████████▊                  │
│ CachedReadBufferCreateBufferMicroseconds            │      67912982.814049181838487647.69 │ ███████████████▋                  │
│ CachedReadBufferReadFromCacheHits                   │       36682.76206411938949147.06 │ ███████████████▌                  │
│ ReadBufferFromFileDescriptorRead                    │       36682.76206411938949147.06 │ ███████████████▌                  │
│ RemoteFSPrefetches                                  │       36682.76206411938949147.06 │ ███████████████▌                  │
│ ThreadpoolReaderSubmitReadSynchronously             │       36682.76206411938949147.06 │ ███████████████▌                  │
│ BackgroundLoadingMarksTasks                         │       27502.676062401770314746 │ ███████████████▏                  │
│ MarkCacheHits                                       │       27502.676062401770314746 │ ███████████████▏                  │
│ OpenedFileCacheMicroseconds                         │       38702.653144433974466345.71 │ ███████████████                   │
│ FileOpen                                            │       18332.63241434774581445.45 │ ██████████████▉                   │
│ OpenedFileCacheMisses                               │       18332.63241434774581445.45 │ ██████████████▉                   │
│ IOBufferAllocBytes                                  │ 41297957748465172.582430274107813344.82 │ ██████████████▊                   │
│ IOBufferAllocs                                      │       57992.397603389250585742.42 │ █████████████▉                    │
│ MetadataFromKeeperCacheHit                          │      1803002.218487496163563740 │ █████████████▏                    │
│ CreatedReadBufferOrdinary                           │       36602.218487496163563740 │ █████████████▏                    │
│ FilesystemCacheHoldFileSegments                     │       36602.218487496163563740 │ █████████████▏                    │
│ FilesystemCacheUnusedHoldFileSegments               │       36602.218487496163563740 │ █████████████▏                    │
│ RemoteFSBuffers                                     │       36602.218487496163563740 │ █████████████▏                    │
│ Seek                                                │       36602.218487496163563740 │ █████████████▏                    │
│ FunctionExecute                                     │      1472332.000385862778428336.91 │ ████████████▏                     │
│ RemoteFSPrefetchedReads                             │       34531.927969525585339335.85 │ ███████████▊                      │
│ OpenedFileCacheHits                                 │       18271.760912590556812433.33 │ ██████████▉                       │
│ PartsLockHoldMicroseconds                           │        7101.549019599857431730 │ █████████▉                        │
│ LoggerElapsedNanoseconds                            │  361183251312831.524984260528184729.61 │ █████████▊                        │
│ RemoteFSSeeks                                       │       55771.4612803567823828.57 │ █████████▍                        │
│ OSWriteChars                                        │    40188546661.336209034340795726.48 │ ████████▋                         │
│ ContextLock                                         │      2453291.280298135854417725.53 │ ████████▍                         │
│ OSReadChars                                         │   4839656111741.013509156896205820.81 │ ██████▊                           │
│ OSWriteBytes                                        │    16384204800.969100130080564220 │ ██████▌                           │
│ SelectedParts                                       │       12150.969100130080564220 │ ██████▌                           │
│ SelectedPartsTotal                                  │       12150.969100130080564220 │ ██████▌                           │
│ SelectedRanges                                      │       12150.969100130080564220 │ ██████▌                           │
│ LogTrace                                            │       60740.910804693473325818.92 │ ██████▏                           │
│ LogDebug                                            │       17200.705810742857072715 │ ████▉                             │
│ CachedReadBufferReadFromCacheBytes                  │   4487705262070.691328042009023814.72 │ ████▊                             │
│ ReadBufferFromFileDescriptorReadBytes               │   4487705262070.691328042009023814.72 │ ████▊                             │
│ RemoteFSPrefetchedBytes                             │   4487705262070.691328042009023814.72 │ ████▊                             │
│ ThreadpoolReaderReadBytes                           │   4487705262070.691328042009023814.72 │ ████▊                             │
│ ThreadpoolReaderSubmitReadSynchronouslyBytes        │   4487705262070.691328042009023814.72 │ ████▊                             │
│ WaitMarksLoadMicroseconds                           │      348305-0.5727940459979509-12.36 │ ████                              │
│ ArenaAllocBytes                                     │    4915240960-0.7918124604762482-16.67 │ █████▌                            │
│ ArenaAllocChunks                                    │       1210-0.7918124604762482-16.67 │ █████▌                            │
│ ReadCompressedBytes                                 │   441904344814-1.0774304213935042-21.97 │ ███████▎                          │
│ FilesystemCacheLockMetadataMicroseconds             │       2317-1.3127891463931898-26.09 │ ████████▌                         │
│ ConcurrencyControlQueriesDelayed                    │        10-inf │   -100 │ █████████████████████████████████ │
│ ConcurrencyControlSlotsDelayed                      │       540-inf │   -100 │ █████████████████████████████████ │
│ ContextLockWaitMicroseconds                         │        80-inf │   -100 │ █████████████████████████████████ │
│ FileSegmentFailToIncreasePriority                   │        10-inf │   -100 │ █████████████████████████████████ │
│ ThreadpoolReaderPrepareMicroseconds                 │        80-inf │   -100 │ █████████████████████████████████ │
└─metric──────────────────────────────────────────────┴───────v1─┴───────v2─┴──────────────────dB─┴───perc─┴─bar───────────────────────────────┘

85 rows in set. Elapsed: 0.074 sec. Processed 2.16 million rows, 102.28 MB (29.19 million rows/s., 1.38 GB/s.)
Peak memory usage: 114.84 MiB.