matanper opened a new issue, #71119:
URL: https://github.com/apache/doris/issues/71119

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   ### Description
   
   String columns are dictionary-encoded by default, but the column dictionary 
is capped at `STORAGE_DICT_PAGE_SIZE_DEFAULT_VALUE` = 256 KB 
(`be/src/storage/segment/options.h`). Once it fills, every later page of the 
segment falls back to plain + LZ4F. Repetitive high-cardinality strings (URLs, 
titles, referers) fill 256 KB early, so most of their pages end up plain.
   
   Codec-level measurement on ClickBench `hits` (1M rows): 64 KB pages, Doris' 
dictionary / LZ4F settings reproduced (LZ4F frame preferences, 10% 
min-space-saving rule). Apple M4 Pro and AWS c7i give the same picture:
   
   | column | dict, 256 KB limit (today) | dict without limit 
(`storage_dict_page_size = 0`) |
   |---|---|---|
   | `Title` | 6.4x | **19.8x** |
   | `URL` | 3.8x, ~5 GB/s decode | **5.3x**, ~8 GB/s decode |
   | `Referer` | 3.8x | **5.0x** |
   | `SearchPhrase` | 7.1x | **8.4x** |
   | 7 string columns total (ClickBench + TPC-H) | 154.9 MB | **110.1 MB 
(-29%)** |
   
   The table property `storage_dict_page_size` (0 to 100 MB) already allows 
this per table, but few users will know to set it. Removing the limit outright 
is not right either. On near-unique text (TPC-H `l_comment`), the decoded 
dictionary outgrows the CPU caches, and decode becomes memory-bound and erratic 
(0.5-1.6 GB/s vs ~2.8 GB/s for plain + LZ4F).
   
   ### Solution
   
   Replace the fixed byte cap with a rule that keeps the dictionary while it 
pays off, for example:
   
   - keep it while (dictionary bytes + code bytes) stays clearly below the 
plain size of the same rows, and
   - keep it while the dictionary stays under a memory cap sized for cache 
residency and segment-writer memory (well above 256 KB);
   
   otherwise fall back to plain pages as today. Keep `storage_dict_page_size` 
as an explicit override.
   
   The thresholds need benchmarking on more datasets (I can share the harness 
and data), and reader-side memory for cached decoded dictionaries should be 
checked as well.
   
   Related: #63622 (split of V2/V3 encoding defaults). A broader proposal for 
lightweight numeric page encodings will be filed separately.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to